Visual studio code: how to automatically change the matching closing tag
Since VSCode 1.44, you can enable automatic updating of matching tags like this:
- Go to File menu, Preferences and Settings
- Search for
editor.linkedEditing
- Enable "Linked Editing"
Here is an example of how it works:
Start VS Code, go to Plugins and search for Auto Rename Tag. Install, reload, done. This plugin: https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag
As mentioned by @TwistedSim, you can achieve this using Ctrl + D
You can use the Rename Symbol command to do this.
- Select (or click to put the caret anywhere inside) the opening tag
- Hit F2
- Enter the new tag name and press Enter
Opening and closing tags will both be renamed.
Alternatively, you can press Shift + Enter at step 3 to preview changes and then Shift + Enter again to apply them.