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

Rope refactoring is failing after reading third party files from node_modules #13876

Closed
amw opened this issue Sep 10, 2020 · 4 comments
Closed
Labels
bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue verified Verification succeeded

Comments

@amw
Copy link

amw commented Sep 10, 2020

I am trying to rename a symbol in one of my first party files using F2 command. It used to work until I added node_modules to my project with some package that has its own Python source file that is causing some kind of parse error. rope should not be looking at files in node_modules/ directory. I believe VS Code knows that this folder is third party code, because it is grayed out in the file browser.

Refactor failed. Syntax error in file <node_modules/node-gyp/test/fixtures/test-charmap.py> line <18>: Missing parentheses in call to 'print'. Did you mean print(textmap[encoding])?
[<FrameSummary file /Users/amw/.vscode/extensions/ms-python.python-2020.8.106424/pythonFiles/refactor.py, line 380 in watch>, <FrameSummary file /Users/amw/.vscode/extensions/ms-python.python-2020.8.106424/pythonFiles/refactor.py, line 350 in _process_request>, <FrameSummary file /Users/amw/.vscode/extensions/ms-python.python-2020.8.106424/pythonFiles/refactor.py, line 259 in _rename>, <FrameSummary file /Users/amw/.vscode/extensions/ms-python.python-2020.8.106424/pythonFiles/refactor.py, line 128 in refactor>, <FrameSummary file /Users/amw/.vscode/extensions/ms-python.python-2020.8.106424/pythonFiles/refactor.py, line 156 in onRefactor>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/refactor/rename.py, line 97 in get_changes>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/refactor/rename.py, line 195 in rename_in_module>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/refactor/occurrences.py, line 76 in find_occurrences>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/utils/__init__.py, line 12 in _wrapper>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/refactor/occurrences.py, line 392 in source_code>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/utils/__init__.py, line 12 in _wrapper>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/refactor/occurrences.py, line 412 in pymodule>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/project.py, line 116 in get_pymodule>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/pycore.py, line 142 in resource_to_pyobject>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/pycore.py, line 255 in get_pymodule>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/pyobjectsdef.py, line 162 in __init__>, <FrameSummary file /Users/amw/.virtualenvs/AP/lib/python3.7/site-packages/rope/base/pyobjectsdef.py, line 191 in _init_source>]

Environment data

  • VS Code version: 1.48.2
  • Extension version: 2020.8.108011
  • OS and version: macOS 10.15
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions:
  • Relevant/affected Python-related VS Code extensions and their versions:
  • Value of the python.languageServer setting: Jedi

Expected behaviour

Rope should ignore node_modules and symbol rename should succeed.

Actual behaviour

Refactoring of Python code in my project fails.

Steps to reproduce:

Installing offending package should cause this issue:

npm install node-gyp
@amw amw added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 10, 2020
@karthiknadig karthiknadig self-assigned this Sep 14, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 14, 2020
@karthiknadig karthiknadig added investigating We are looking into the cause of the issue and removed triage labels Sep 15, 2020
@karthiknadig
Copy link
Member

@amw This might be something that should be filed on rope. We invoke rope directly, so we don't control how rope looks at the files in the workspace.

@amw
Copy link
Author

amw commented Sep 15, 2020 via email

@karthiknadig
Copy link
Member

When you use rope for the first time in a project, it will create this folder. This is where you would put any configuration for rope.
image

@kimadeline
Copy link

rope is being removed in the 2021.10 release (#17225), closing this issue as stale. Refactoring is now provided (via a lightbulb action) by the language server (either Jedi or Pylance).

@kimadeline kimadeline added the verified Verification succeeded label Sep 21, 2021
@kimadeline kimadeline added this to the September 2021 milestone Sep 21, 2021
@karthiknadig karthiknadig removed their assignment Oct 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants