Ask questionsrename feature failed with 'Refactor failed'

Environment data

  • VS Code version: 1.39.1(system setup)
  • Extension version (available under the Extensions sidebar): 2019.10.41019
  • OS and version: Windows 10 Home (local), wsl ubuntu 18.04 (access remotely)
  • Python version (& distribution if applicable, e.g. Anaconda): Py3.7.3 & Anaconda:4.7.10
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): The code runs on remote WSL ubuntu 18.04 with local network
  • Relevant/affected Python packages and their versions: n/a
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info #3977): not enable

Expected behaviour

Expect rename success.

Actual behaviour

An Error as “Refactor failed”

Steps to reproduce:

  1. double click a variable;
  2. press F2;
  3. enter a new name of it.

<!-- Note: If you think a GIF of what is happening would be helpful, consider tools like, or . -->


Refactor failed. Syntax error in file <> line <177>: unindent does not match any outer indentation level [<FrameSummary file, line 294 in watch>, <FrameSummary file, line 275 in _process_request>, <FrameSummary file, line 206 in _rename>, <FrameSummary file, line 117 in refactor>, <FrameSummary file, line 138 in onRefactor>, <FrameSummary file /home/hkb/anaconda3/lib/python3.7/site-packages/rope/refactor/, line 23 in init>, <FrameSummary file /home/hkb/anaconda3/lib/python3.7/site-packages/rope/base/, line 116 in get_pymodule>, <FrameSummary file /home/hkb/anaconda3/lib/python3.7/site-packages/rope/base/, line 142 in resource_to_pyobject>, <FrameSummary file /home/hkb/anaconda3/lib/python3.7/site-packages/rope/base/, line 255 in get_pymodule>, <FrameSummary file /home/hkb/anaconda3/lib/python3.7/site-packages/rope/base/, line 162 in init>, <FrameSummary file /home/hkb/anaconda3/lib/python3.7/site-packages/rope/base/, line 191 in _init_source>]


Answer questions karthiknadig

We use for refactoring. Looks like there might have been an indentation issue in your code. If you feel there is still an issue please report it to the linked repository.

Karthik Nadig karthiknadig @Microsoft Redmond Developer at Microsoft, working on VS Code Python and Python Debugger.
Github User Rank List