-
Notifications
You must be signed in to change notification settings - Fork 765
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 symbol: No result #441
Comments
Have upgraded and am still experiencing this with Pylance language server 2020.9.7 (pyright a0620921) |
Thanks for the bug report. I'm not able to repro this in either Pylance or Pyright. Do you have any non-default settings enabled that might affect this? |
I'm also experiencing this exact same issue. Going to try this on another os with a fresh install and report back. Edit: |
Ok so I've discovered something, but I'm not yet sure if this is related to pylance itself. I'm able to perform a rename in a workspace without a venv. As soon as I create a new venv then I'm unable to rename. |
Ah, so in my case it's because I haven't opened a folder yet. This is how I repro: Open a new VSCode window, and open a single file. Rename symbol will fail in that file. In the same window now open the file's folder. Rename symbol will succeed. @VladimortZA are you using a pyrightconfig.json? If the |
Good clue! Interesting, it looks like this might be a bug in VS Code. The language server isn't receiving an @jakebailey, any thoughts about this? |
Single file mode has always been a bit shoddy, but it might be an artifact of how the core extension manages the LS connection. A test would be to repeat the same thing with the pyright extension (which doesn't do anything but start the client for all Python requests). |
I already confirmed that the same thing occurs with the Pyright extension, so that would seem to indicate it's a problem with VS Code, not the core Python extension. |
Very strange. I haven't seen this before (and quick searching the VS Code issues doesn't net anything, but there are literally a hundred thousand issues). |
I have same problem. Must be pretty hard to track down the cause beacuse everybody has different setup... Python 3.7.7 64-bit. Pylance 2020.12.1, Python 2020.11.371526539 Version: 1.51.1 (user setup) For me, it looks like there one file that it misbehaves with. It is the largest file in my project at ~800 lines of code. It seems to work on the smaller files in my project fine. Not sure if it's related to size of the file. There must be something in the large file that making it crap out. I don't really want to post the file publicly. |
Looks like is unrelated to size of the file but the extension of the file. It looks like if the extension is not ".py" you will get this problem. Seen it happen on ".pyw" files and it works fine when renamed to ".py". Should work on all files extentions associated with python. Here are a few:
|
For me this happens when the file is in a project subfolder. In a flat project structure (all files beside each other in the opened folder) the command works as expected. Since all of my projects contain a more or less complex folder structure the bug is quite annoying. |
We only support python in py and pyi files; any other format isn't supported (and overriding it probably confuses Pylance). I think pyw is the same syntax, so potentially that could be supported, but this is the first time I've seen it in practice. |
pyw extention are for windowed python programs created from wxpython, pyqt, tkinter. |
Just to cross-link it, for extensions that aren't py or pyi, see #739. |
@MiMiMeowMeow #739 should be fixed in the next release; I don't know if I can close this issue though as the original issue was not file extension related. |
What solved it for me was to:
|
For me, the problem was Pylance itself....for temporary solving, you can change the "python.languageServer" in setting json file from "Pylance" to "Microsoft" and then it works with Microsoft. |
@majidhas if you had a way to reproduce this, that'd be much appreciated. We'd like to fix it here and not have people resort to switching to the old language server. |
I meet this issue, too. But when I try to rename this symbol again, it worked. I don't know why. |
I am experiencing the same thing. Sometimes does not work on the first shot, but worked in the second time. |
The fact that it fails the first time but succeeds the second time is interesting. I see this with other calls as well, like when I reproduced #227 (which is go-to-def, not rename). I'm wondering if this is all some common issue. |
I experience the very same issue. Whenever im trying to rename or go-to-def for the first time in a file it does not work. Repeating either command is working just fine though. |
I have both issues: go-to-def and rename work on the second try only (the first yields "no results"). After doing that in one file, it seems to keep working in this file, but the other open ones still have the issue. This is VSCode 1.54.3 (system setup) on Windows 10, in a venv. |
This is related to issue #1069. As I mentioned in that thread, my investigation leads me to think this is a bug in the core Python extension. |
See microsoft/vscode-python#15727; this is a bug in the core extension and we'll fix it there. |
Just to show the original issue working: I'll close this (and the numerous other issues the bug caused) when the core extension's point release is done. Note that the bug I introduced into the core extension was only added earlier this month. It's possible the original issue wasn't fixed but having tested it I believe it to be, so we can reopen it as needed. |
This is now fixed in the core extension (v2021.3.680753044). |
The error does not occure in the current stable release. Everthing works perfectly fine for me using VS Code version 1.55.2 |
Yes, please file a new issue. This issue was caused by a client bug that's since been fixed. |
Hi! In my case this seems to happen when opening a simple file in an untrusted [yet] workspace. It doesn't happen when I open a project (not a single file) in a trusted workspace. |
The Python extension and Pylance don't (yet) support untrusted workspaces, so no features are going to work as the Python extension doesn't start Pylance. |
I'm sorry to say that this still happens for As soon as I rename the offending file to This is happening in a trusted folder. Is there anything I can do in order to provide more useful information? |
That would be #1636. |
I checked that, @jakebailey , but apparently Pylance now supports Also, the file mode is properly set as Anything wrong on my side that I can check? Thanks a lot for the reply, @jakebailey . |
I'm not sure what you mean. The linked issue may talk about .sage, but the issue is more generic around anything that's not just a .py or .pyi. The language you have set the file to doesn't change that we are excluding other extensions from our list of source field where refactoring is valid. |
Oh, sorry, my bad then. I assumed that since Pylance supported Any possibility of including And again, @jakebailey thanks A LOT for your help. I was seeing the whole picture 😃 |
That is precisely what #1636 covers. |
Environment data
Expected behaviour
Renaming a function argument renames its usage within the function
Actual behaviour
No result
Logs
Code Snippet / Additional information
The text was updated successfully, but these errors were encountered: