You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rename Symbol fails without error when no workspace folder is open #5301
Python version : Python 3.7.3 64-bit, Anaconda (user)
Type of virtual environment used : conda
Relevant/affected Python packages and their versions: rope-0.12.0
Expected behaviour
Variables renamed
Actual behaviour
File untouched.
Steps to reproduce:
Freshly installed Anaconda, installed rope, opened .py file in VSCode, interpreter selected.
Click on any variable and use Rename Symbol box.
Logs
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
None
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)
...
Python Extension: setGlobalInterpreter, Class name = g, Arg 1: {"architecture":3,"path":"C:\\Users\\hbere\\Anaconda3\\python.exe","version":{"raw":"3.7.3-final","major":3,"minor":7,"patch":3,"prerelease":["final"],"build":[],"version":"3.7.3-final"},"sysPrefix":"C:\\Users\\hbere\\Anaconda3","fileHash":"0e38ee8f1a51d3d38a15a105e2380534ea2e2bdda7603f37a7ee998363290170d7c38eeb98cff5e8e9e023c8ef1b40cb809a563b6d1b7cf6620a6205afe32481","companyDisplayName":"Anaconda, Inc.","type":"Conda","cachedEntry":true,"envName":"base","envPath":"C:\\Users\\hbere\\Anaconda3","displayName":"Python 3.7.3 64-bit ('base': conda)"}, Arg 2: undefined, Return Value: false
...
Python Extension: Cached data exists getEnvironmentVariables, c:\Users\user\.vscode\extensions\ms-python.python-2019.3.6558\out\client
The bottom line is replicated in the console when I try to rename again.
Other features like autocomplete or Outline work fine. Any ideas?
Along the way, I've found out that this bug occurs only if I don't have the folder containing the file opened in VSCode. Opening the folder containing my test file and reopening the editor got the refactor to work.
Sorry for not spotting that earlier. I'm updating the issue title.
Actually this is kind of not supposed to work. However if the variables were inside a function, it works,
def hello():
df = 2
df = 3
This is because ab is a global variable, so rope doesn't know how to resolve references of ab outside the file, because it doesn't know where to look.
However if a workspace folder is specified, it can resolve references within it. I hope this clear things up. Closing this.
Activity
karrtikr commentedon Apr 16, 2019
Please provide the simplest file content that reproduces this bug
[-]Rename Symbol Fails without error[/-][+]Rename Symbol fails without error when no workspace folder is open[/+]Ddedalus commentedon Apr 16, 2019
The simplest file I tested was just
Along the way, I've found out that this bug occurs only if I don't have the folder containing the file opened in VSCode. Opening the folder containing my test file and reopening the editor got the refactor to work.
Sorry for not spotting that earlier. I'm updating the issue title.
karrtikr commentedon Apr 17, 2019
Actually this is kind of not supposed to work. However if the variables were inside a function, it works,
This is because
abis a global variable, soropedoesn't know how to resolve references ofaboutside the file, because it doesn't know where to look.However if a workspace folder is specified, it can resolve references within it. I hope this clear things up. Closing this.