-
Notifications
You must be signed in to change notification settings - Fork 767
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
Rename local variable #2457
Comments
The code that you pasted above has a syntax error because there's an extra space before |
Sorry for that syntax error. On further experimentation I find that if I create a small example project with the above code, rename works fine, but if I try to do the same rename in the context of my large project, things get wonky:
Haven't systematically explored this, but my guess is that pyright is not following a simple optimized path for local variable renames, and instead at least part of the pathway is identical to what's used for project-wide renames (which can be very slow). This makes local var renames slow on large projects. Is that correct? |
Pyright follows an optimized path for local variables like The "subsequent ones don't work" is probably explained by the fact that you're using neovim which doesn't support asynchronous (file-based) cancellation, so all LSP commands must run to completion. If the first one takes a long time, you'll need to wait for it to finish. |
Hmm I just tried renaming def myfunc():
foo = 1
print(foo) Is this something you would expect, given that Looking at Neovim's LSP logs, it looks like the
In contrast, when I perform the same rename in my toy project the immediate response is not empty:
Also: have you considered having Pyright apply privacy rules when renaming? For instance, if I have a function |
It sounds like more investigation is needed. Since this is a language server feature and not a core type checking issue, I'm going to transfer it to the pylance-release project. |
@smackesey can you try it on vscode pylance and let us know whether it still repro? if it does, can you provide a log following instructions on https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#filing-an-issue ? it should give us more context to figure out what is going on. thank you. |
@heejaechang Do you still need help with this? I see you added a "fixed in next version" label. |
I added our rename to limit scope a bit more if we can. please, try next release and let us know. thank you. |
This issue has been fixed in version 2022.3.3, which we've just released. You can find the changelog here: CHANGELOG.md |
Not sure if this is a bug or purposefully unsupported feature, but attempting to rename a local variable in LSP mode appears to be a no-op:
Running
pyright
1.1.227 in LSP mode in Neovim.The text was updated successfully, but these errors were encountered: