Visual Studio Code (Mac OS) rename symbol doesn't work Visual Studio Code (Mac OS) rename symbol doesn't work python python

Visual Studio Code (Mac OS) rename symbol doesn't work


It turns out the solution was simple, but frustrating. To do refactoring in VS Code (at least for python) you need to be in a workspace.

I solved the problem by first closing the open folder I was in:

File > Close Folder.

then navigating to a sub folder of .py file I was editing, and opening it. In my case it was

  1. Click the little document icon in the upper left of screen
  2. In the welcome screen, choose "open folder"
  3. navigate to my desktop folder (where my .py file is)

Now refactoring works as expected

Click on file icon in upper left of screen > in the welcome screen


Choosing a folder did not solve the issue for me. I switched to a new language server called Pylance and everything works fine now.


I use Pylance with a workspace and had the same issue. For me the solution was to restart the language server (from the Command Palette). I find it faster than closing and opening the folder.

Ctrl+Shift+P > Python: Restart Language Server