Visual-Studio-Code – How to choose Div’s internal in Visual Studio Code

For example. I have


bar

How to use shortcut keys to select all content?

Notepad has this function. When the div content becomes very long, scrolling or collapsing the selection will be annoying.

you can use The Emmet command selects it, if you place the cursor somewhere inside the first tag, just use Emmet: Balance (outward) and Emmet: Balance (inward). If you are executing a lot of HTML, you only need Type Emmet: in the command palette to check more Emmet commands.

Because it is mentioned in another answer:

By default, “Extensions The function of the area” plugin is supported, please refer to this answer in another thread

This does not support shrinking/increasing the selection around HTML tags, but you can easily set shortcuts to use Emmet in HTML files And use the above command in the same shortcut. The syntax used to set this syntax looks like this (feel free to replace ctrl up/ctrl with whatever you like):

{
"key": "ctrl+up",
"command": "editor.action.smartSelect.grow",
"when": "editorTextFocus"
},
{
"key": "ctrl+up",
"command": "editor.emmet.action.balanceOut",
"when": "editorTextFocus && editorLangId == html && editorHasSelection"
},
{
"key": "ctrl+down",
"command": "editor.action.sma rtSelect.shrink",
"when": "editorTextFocus"
},
{
"key": "ctrl-down",
"command": " editor.emmet.action.balanceIn",
"when": "editorTextFocus && editorLangId == html"
},

Only for clarification, the editorHasSelection section allows the first key press When expanding the internal string (for example, for selecting/editing tag attributes).

For example. I have


bar

How to use shortcut keys to select everything?

Notepad has this function. When the div content becomes very long, scrolling or folding selection will be very annoying.

You can Use the Emmet command to select it. If you place the cursor at a certain position within the first tag, just use Emmet: Balance (outward) and Emmet: Balance (inward). If you are executing a large amount of HTML, only You need to type Emmet: in the command palette to check more Emmet commands.

Because it is mentioned in another answer:

By default, ” The function of the “Extended Area” plugin is supported, please refer to this answer in another thread

This does not support shrinking/increasing options around HTML tags, but you can easily set shortcuts for use in HTML files Emmet, and use the above command in the same shortcut. The syntax used to set this syntax looks like this (feel free to replace ctrl up/ctrl with whatever you like):

{
"key": "ctrl+up",
"command": "editor.action.smartSelect.grow",
"when": "editorTextFocus"
},
{
"key": "ctrl+up",
"command": "editor.emmet.action.balanceOut",
"when": " editorTextFocus && editorLangId == html && editorHasSelection"
},
{
"key": "ctrl+down",
"command": "editor.action.smartSelect.shrink ",
"when": "editorTextFocus"
},
{
"key": "ctrl-down",
"command": "editor.emmet .action.balanceIn",
"when": "editorTextFocus && editorLangId == html"
} ,

Just for clarification, the editorHasSelection part allows the internal string to be expanded at the first keypress (for example, for selecting/editing tag attributes).