Wrap selection with tag in VS Code
1. CTRL + SHIFT + P
2. Type 'wwa' and select 'Emmet: Wrap with Abbreviation'
3. Type the emmet abbreviation you want to use
Thanks to the built-in Emmet support doing some tag wrapping in VS Code is a simple task. For example, if you want to wrap the text under the cursor with a div
tag using a CSS class named main-header
, then do the following steps. Press CTRL + SHIFT + P
or F1
and type "wwa" in the popup window. Select the Emmet: Wrap with Abbreviation command and press Enter. The input dialog changes to an Emmet editor. Now you can type your emmet command. In this example, type .main-header
. While typing, you can immediately see the planned modification in the code editor. Press Enter, and VS Code wraps your code with a div
tag using the class main-header
. To cancel the changes, press Esc.
You can write more complex emmet commands like .main-header>.title>h1
.
In the case of React JSX files VS Code also takes care that the className
attribute should be used instead of the class
attribute.
- Fix: Prettier stopped working in VS Code
- Split editor window in VS Code
- Change default terminal in VS Code
- Wrap selection with tag in VS Code
- Edit multiple lines at once in VS Code
- Make text uppercase in VS Code
- Associate file type in VS Code
- Change syntax highlighting in VS Code
- Search for file in VS Code
- Change indentation in VS Code
- Collapse code blocks in VS Code
- Open files always in a new tab in VS Code
- Add vertical rulers in VS Code
- Delete line without selection in VS Code
- Jump to closing bracket in VS Code
- Select all occurrences of selected word in VS Code
- Change font size in VS Code
- Toggle minimap in VS Code
- Change colors in VS Code integrated terminal
- Change file encoding in VS Code
- Disable tooltip in VS Code
- Move the sidebar panel to the right in VS Code
- Export VS Code extensions
- Toggle word wrap in VS Code
- Exclude folders from search in VS Code
- Get multiple cursors in VS Code
- Show hidden characters in VS Code
- Remove trailing spaces in VS Code
- Go back to last edited position in VS Code
- Switch between terminal and editor in VS Code
- Open VS Code with the current folder from terminal
- Navigate back to last cursor position in VS Code
- Change terminal font size in VS Code
- Duplicate line or selection in VS Code
- Format code in VS Code
- Compare two files in VS Code
- Comment out multiple lines in VSCode
- Go to line in VS Code
- Move line up or down in VS Code