STOP VS Code from automatically renaming all other occurrence of a variable

Understanding the situation:

When you try to edit one variable name on a file, all the other occurrences of the same variable automatically gets renamed.

You might not want that to happen in certain scenario.

You can change this behavior by disabling Linked Editing feature of the VS code editor.

Disable Linked Editing

Follow the steps below to disable the linked editing that solves the problem:

  1. Open Settings: Hit “Ctrl + ,” or go to File > Preferences > Settings.
  2. Enter term such as linked editing in the search input.
  3. You should see results with check box. Depending on the requirement, you need to choose which checkbox to uncheck. For example, if you want to apply this setting to PHP files only, uncheck the checkbox below PHP > Linked Editing: Variables.
Disable Linked Editing for PHP local variables
Disable Linked Editing for PHP local variables
Loading spinner

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.