I want to configure a keyboard shortcut to rename a jsx tag only when a cursor is on an actual jsx tag.
Is there something that allows this?
source: https://code.visualstudio.com/api/references/when-clause-contexts#editor-when-clause-contexts
tl;dr
Currently CtrlF2 is mapped to changeAll
, which is useful on its own, but in this case it results in ALL tags of the same name being targeted and renamed.
{
"key": "ctrl+f2",
"command": "editor.action.changeAll",
"when": "editorTextFocus && !editorReadonly"
},
Therefore I want to use an extension that handles it per instance and be able to map it ideally to the same key and switch depending on cursor focus, like this:
{
"key": "ctrl+f2",
"command": "editor.emmet.action.updateTag",
"when": "editorTextFocus && !editorReadonly && scope == 'entity.name.tag.tsx'"
},
This is the output of >Developer: Inspect Editor Tokens and Scopes
command, where the scopes can be seen.