Skip to content

Rename Symbol fails without error when no workspace folder is open #5301

Closed

Description

Environment data

  • VS Code version: 1.33.1
  • Extension version: 2019.3.6885
  • OS and version: Windows 10.0.17763 Build 17763
  • 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?

Activity

  1. ghost added
    triage-neededNeeds assignment to the proper sub-team
    on Apr 16, 2019
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Apr 16, 2019
  3. karrtikr commented on Apr 16, 2019

    @karrtikr

    Please provide the simplest file content that reproduces this bug

  4. changed the title [-]Rename Symbol Fails without error[/-] [+]Rename Symbol fails without error when no workspace folder is open[/+] on Apr 16, 2019
  5. Ddedalus commented on Apr 16, 2019

    @Ddedalus
    Author

    The simplest file I tested was just

    ab = 2
    ab = 3
    

    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.

  6. ghost removed
    info-neededIssue requires more information from poster
    on Apr 17, 2019
  7. ghost removed on Apr 17, 2019
  8. karrtikr commented on Apr 17, 2019

    @karrtikr

    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.

  9. locked as resolved and limited conversation to collaborators on May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions