Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS Code variable renaming doesn't work in *new* workspaces when Deno plugin is enabled #585

Closed
jaredkrinke opened this issue Nov 30, 2021 · 10 comments · Fixed by denoland/deno#17979
Labels
bug Something isn't working needs investigation

Comments

@jaredkrinke
Copy link

jaredkrinke commented Nov 30, 2021

Describe the bug
VS Code's F2/Ctrl+Shift+R rename for variables doesn't work in new workspaces when the Deno plugin is enabled. It works fine in TypeScript projects where I haven't enabled the Deno plugin.

To Reproduce

  1. Create a new folder and open it in VS Code
  2. Initialize the Deno plugin for the workspace
  3. Create a new TypeScript file
  4. Type some code, e.g. const tmp = 5;
  5. Put the cursor on tmp
  6. Hit F2 (or use Refactor -> rename from the right-click context menu)
  7. Type in the new name

Expected behavior
The variable and all occurrences of the variable are renamed (this is what happens in projects where the Deno plugin hasn't been enabled).

Actual behavior
Nothing happens.

Screenshots
I can provide them, if needed.

Versions
Deno plugin version:
v3.9.2

VS Code versions:

Version: 1.63.2 (system setup)
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:40:02.816Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042

@kitsonk kitsonk added bug Something isn't working needs investigation labels Nov 30, 2021
@jdelarubia
Copy link

jdelarubia commented Dec 1, 2021

I've been experiencing the same issues but I have been able to "fix" it by tweaking some vscode workspace settings.
Sample settings:

{
    "deno.enable": true,
    "deno.path": "c:\\deno\\deno.exe",
    "deno.lint": true,
    "deno.internalDebug": true
}

Now, for this project, I can delete the deno.path or, disable deno.lint or deno.internalDebug and it keeps working. It seems to have picked up whatever, so I have no good explanation for this.

@jaredkrinke
Copy link
Author

So... this just started working for me in Deno projects today. All my Deno, Deno plugin, and VS code versions are identical, but I did reboot my computer once in the meantime.

F2/rename had been consistently broken for me for at least a day when I opened this issue, but it's working now, so I'm going to close this issue to avoid distracting the Deno authors with something I can't even reproduce anymore.

@jdelarubia (or anyone else) if this still happens to you after a reboot, consider reopening the issue.

@jaredkrinke
Copy link
Author

This happened to me again today but restarting VS Code fixed it. I'm still not sure how I keep getting into this state.

@outloudvi
Copy link

I can replicate this: renaming doesn't work for a workspace that was just created, but work after restarting VSCode. Not sure if this a problem at vscode_deno's side or VSCode's side, but the behavior seems to be reproducible.

@jaredkrinke jaredkrinke changed the title VS Code variable renaming doesn't work when Deno plugin is enabled VS Code variable renaming doesn't work in *new* workspaces when Deno plugin is enabled Dec 27, 2021
@jaredkrinke
Copy link
Author

@outloudvi figured out that this happens when you open a new workspace and initialize it for Deno the first time. Updated title and steps to reflect this.

@jaredkrinke jaredkrinke reopened this Dec 27, 2021
@martin-braun
Copy link

For me refactoring in a workspace won't work at all, no matter if I restart VSCode or initialize Deno for the first time or not.

@chmac
Copy link

chmac commented Mar 13, 2022

I'm experiencing similar issues. When I export a const from one file, renaming in that file wouldn't work, but renaming from another file did successfully rename all instances, and after having done that, renaming in the original file now works. I also tried enabling / disabling the settings @jdelarubia shared above, can't say if this had an impact. Seems like an intermittent bug which will likely be hard to track down.

@smack0007
Copy link

I had this problem in a project and it turned out that I had specified to use an import map that did not exist (copy and paste error from a different project). Deno was showing me a warning in a vscode popup window that I of course have ignored for several days. After removing the import map config value and restarting vscode Rename Variable started to work for me again.

@shinebayar-g
Copy link

shinebayar-g commented Feb 9, 2023

Wow just ran into this and had a mini heart attack. Rename function (F2) didn't rename the variables (did nothing). I reloaded the VSCode and it finally started worked again. 😌

@TheCymaera
Copy link

TheCymaera commented Feb 10, 2023

Same issue. Happened at least once before. Fixed by reloading window (> Developer: Reload Window).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants