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

Rename symbol failed to work, only showing "No result" notification #1069

Closed
cenwangumass opened this issue Mar 18, 2021 · 33 comments
Closed
Labels
waiting for upstream Waiting for upstream to release a fix

Comments

@cenwangumass
Copy link

Environment data

  • VS Code version: 1.54.3
  • Extension version (available under the Extensions sidebar): v2021.3.658691958
  • OS and version: Fedora 33
  • Python version (& distribution if applicable, e.g. Anaconda): NA
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): NA
  • Relevant/affected Python packages and their versions: NA
  • Relevant/affected Python-related VS Code extensions and their versions: NA
  • Value of the python.languageServer setting: Pylance

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

After clicking F2 and giving a new name to a local variable, all related symbols should change to the new name.

Actual behaviour

After clicking F2 and giving a new name to a local variable, only a "No result" notification showed up in the bottom right. Strangely, doing this a second time will succeed. This function also worked without problem in the previous version v2021.2.636928669.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. In a folder, create a Python file main.py and define the following function:
def main():
    x = 1
    print(x)
  1. Use VSCode to open the folder and click on the file.

  2. Click on variable x and press button F2, rename it to y. This will fail.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@brettcannon brettcannon transferred this issue from microsoft/vscode-python Mar 18, 2021
@judej
Copy link
Contributor

judej commented Mar 18, 2021

Thanks for the report. Will investigate the problem

@judej judej added the needs investigation Could be an issue - needs investigation label Mar 18, 2021
@github-actions github-actions bot removed the triage label Mar 18, 2021
@ddaspit
Copy link

ddaspit commented Mar 19, 2021

I have the same issue. In addition, when I try using "Find All References" on a function, I initially get "No results." in the "References" sidebar. When I run it again, it works. I am guessing that these two issues are related.

@jdelarubia
Copy link

I experienced the exact same issue on my system. It seems that server stopped working in recent versions of vscode, at least for me.
My tests are on a Windows 10 machine, Python 3.9.1 64 bits, vscode 1.54.3 (system setup CLEAN install).
I recorded 2 GIFs which I hope illustrates the problem when trying a variable rename. However as pointed out by @ddaspit , finding references won't work either.

test-jedi
Now, the same refactor using Pylance.
test-pylance

@erictraut
Copy link
Contributor

This appears to be a bug in the core Python extension. It is not forwarding the "onRenameRequest" call to Pylance.

The problem doesn't occur in Pyright or in the debug version of Pylance that uses its own minimal client.

@marvey11
Copy link

Same issue with both renaming (variables/functions/methods/classes/...) and following references and similar. It does not happen consistently, but still most of the time (on the first try).

As a workaround at the moment, I can usually do the action again and it works (i.e. renaming a variable on the second try mostly works; when following a reference, hitting F12 also mostly works on the second try).

@jakebailey
Copy link
Member

See microsoft/vscode-python#15727; this will be fixed in the core extension.

@jakebailey jakebailey added waiting for upstream Waiting for upstream to release a fix and removed needs investigation Could be an issue - needs investigation labels Mar 22, 2021
@jakebailey
Copy link
Member

This is now fixed in the core extension (v2021.3.680753044).

@WORMSS
Copy link

WORMSS commented Dec 7, 2021

Did this get re-broken? I have v2021.11.1422169775 and I am getting the no result problem.

@heejaechang
Copy link
Contributor

@judej we probably want to tell users why rename failed rather than just showing "No Result"

@heejaechang
Copy link
Contributor

@WORMSS can you open new issue and provide us repro steps for your "no result" issue? unless repro is same as one in this issue's description.

@WORMSS
Copy link

WORMSS commented Dec 7, 2021

Exactly the same steps as above. Just pressing F2 on a "variable" / "function" etc etc.
asks for a name, you type a new name.... No results

@heejaechang
Copy link
Contributor

@WORMSS can you provide us a log or some screencast? I just tried and it worked as expected.

@toresbe
Copy link

toresbe commented Dec 12, 2021

Just as a data point here: As a complete newbie to vscode, I have been experiencing this issue on latest release both on Python and TypeScript which is what brought me to this issue.

@yankee14
Copy link

I'm having this issue in vscode jupyter, but works fine when editing regular python.

@marcbertola
Copy link

marcbertola commented Dec 15, 2021

I was also seeing this problem:
Python 3.6.9 64 bit with a virtual environment

I checked my python extensions and found Python and Pylance

Uninstalling Pylance seems to have fixed it.

@RamzeeRSBOT
Copy link

I was also seeing this problem: Python 3.6.9 64 bit with a virtual environment

I checked my python extensions and found Python and Pylance

Uninstalling Pylance seems to have fixed it.

Thank you. I uinstalled Pylance, used JEDI as language server then re-installed Pylance and reverted back to Pylance. That made it work. Using WLS.

@OchotaDariusz
Copy link

Reinstall extension Pylance and it will work

@DaniyalAhmadSE
Copy link

Reinstalling Pylance did not work for me, and none other solution too

@erictraut
Copy link
Contributor

Please open a new issue with the requested details, and we can take a look at it. It's unlikely that it's related to this issue, which has been fixed and closed for a long time.

@DaniyalAhmadSE
Copy link

@erictraut Actually i found this almost impossible to reproduce intentionally. It just works sometimes, and sometimes doesn't. If I keep Pylance disabled. Everything works fine. But with it enabled. Things are just unpredictable. It happens randomly which is even more disturbing.

@ah3243
Copy link

ah3243 commented Feb 22, 2022

I've had this issue as well. uninstalling or disabling pylance has no effect for me.

@OchotaDariusz
Copy link

Some variables can't be renamed by F2 when you call them "table" in example, try "table_something" then you will can change it

@renjujv
Copy link

renjujv commented Mar 2, 2022

Still getting the issue with pylance. Tried switching to Jedi and the refactor worked as expected.

Here's what I tried:

  1. Reinstalled Python plugin - ms-python.python - Didn't fix
  2. Switched to Jedi and switched back to Pylance - Didn't fix

@OchotaDariusz
Copy link

Some variables can't be renamed by F2 when you call them "table" in example, try "table_something" then you will can change it

@renjujv check if your variables isn't called like "table" "list" etc

@renjujv
Copy link

renjujv commented Mar 4, 2022

@OchotaDariusz I tried for multiple variables with different names. Some of the names which I tried to refactor were 'image_name', 'response_json' e.t.c

Also checked with a variable without underscore character to confirm that the issue is not caused due to symbols. No luck.
Tried the same in pre_release version of the extension as well.

For any refactor, I'm getting the same error - No result

@SergioG-M
Copy link

SergioG-M commented Mar 7, 2022

Same issue here with python extension v2022.2.1924087327

@TomerBass
Copy link

TomerBass commented Mar 8, 2022

Same issue here with python extension v2022.2.1924087327

Same version here but it is working again. I just had to press "reload" button next to the extension symbol.

Update - Well, I thought it was fixed but it seem to work only part of the times.

@g1ronn1mo
Copy link

I seem to have the same issue, but the prompt looks like no result, no result, no result. This could be due to the fact that I am conncting via SSH to a server and then to a container, where my workbench is located.

@bartekpacia
Copy link

Same issue, the notification I'm getting says No result. No result. No result.

VSCode v1.65.2 with following extension:

  • Pylance v2022.3.1
  • Jupyter v2022.2.1030672458
  • Python v2022.2.1924087327

@aws-stdun
Copy link

Still broken, should be re-opened.

@debonte
Copy link
Contributor

debonte commented Sep 1, 2022

@aws-stdun, please open a new issue and we can take a look at it. It's unlikely that it's related to this issue, which has been fixed and closed for a long time.

@shandou
Copy link

shandou commented Sep 21, 2022

I am also having issues when using both Microsoft python extension and pylance. Without the latter, my code autocompletion becomes buggy, however, when using pylance as the language server, renaming symbol would fail to change all references and this become hugely inconvenient for refactoring. My current workaround is to change language server to Jedi, but yet to know if additional conflicts would occur.

Would love to see if others have similar problems and how it gets resolved.

@bschnurr
Copy link
Member

Please create a new issue and provide details on how to reproduce. In the past there has been issues related to "open file vs open folder" modes and multiple workspaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for upstream Waiting for upstream to release a fix
Projects
None yet
Development

No branches or pull requests