Select expression occurrencespro
Start a multi-cursor selection on several occurrences of the same expression.

The "select expression occurrences" code action finds additional occurrences of the currently selected expression (full text selection) and starts a multi-cursor selection on them. With the multi-cursor selection, you can edit all occurrences in parallel.
The code action uses expression equality, not text equality. This means that only expressions that have the same variable bindings and this
scope (when this
is part of the expression) are considered as additional occurrences.
Why is this refactoring helpful?
Editing multiple occurrences of an expression is useful in many cases, e.g., to fix code snippets after copy-pasting them.
Visual Studio Code allows you to select multiple occurrences of the same text, but this can be imprecise especially for very short variable names. The "select expression occurrences" uses semantic equality, not text equality.
Configuration
- Code Assist ID (for the configuration file):
select-expression-occurrences
- You can configure custom keyboard shortcuts with this code action kind:
refactor.action.p42.select-expression-occurrences