VSCodeVim / VSCodeVim/Vim

"visual inside tag" `vit` selects part of opening tag when the element spans multiple lines

Open
#6,555 0 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug

When selecting the insides of a multiline HTML/XML/JSX tag with vit, the closing > of the opening tag is part of the selection. This does not happen if the tag is on a single line OR if there is trailing space after the opening tag.

<!-- Single-line div -->
<div>Hello</div>

<!-- After "vit, d" in "Hello" -->
<div></div>

<!-- Multi-line div -->
<div>\n
    Hello
</div>

<!-- After "vit, d" in "Hello" -->

<div</div>

Should be
<div></div>

<!-- Multi-line div with trailing space after opening tag -->
<div>\_\_
    Hello
</div>

<!-- After "vit, d" in "Hello" -->
<div></div>

To Reproduce

  1. Open a buffer and enable the HTML, XML, Vue, JSX, etc. grammar
  2. Type a multi-line div
  3. In normal mode, go to the insides of the tag
  4. Press vit
  5. The selection will span > from the opening tag, up to (but not including) the < of the closing tag.

Expected behavior

The selection will span from the \n after the opening tag to the < of the closing tag.

Screenshots

Scopes of the opening >

CleanShot 2021-04-26 at 13 02 40

CleanShot 2021-04-26 at 13 02 52

Video
vim vat

Environment (please complete the following information):

alexnho.a-touch-of-lilac-theme@1.2.3
bceskavich.theme-dracula-at-night@2.7.0
be5invis.vscode-custom-css@5.0.2
christian-kohler.path-intellisense@2.3.0
dbaeumer.vscode-eslint@2.1.20
dracula-theme.theme-dracula@2.22.3
eamodio.gitlens@11.4.1
EditorConfig.EditorConfig@0.16.4
gitduck.code-streaming@0.2.12
miguelsolorio.fluent-icons@0.0.7
monokai.theme-monokai-pro-vscode@1.1.19
ms-azuretools.vscode-docker@1.12.1
ms-python.python@2021.4.765268190
ms-toolsai.jupyter@2021.5.745244803
ms-vscode-remote.remote-containers@0.166.1
ms-vscode.atom-keybindings@3.0.9
msjsdiag.debugger-for-chrome@4.12.12
npxms.hide-gitignored@1.1.0
octref.vetur@0.33.1
oderwat.indent-rainbow@7.5.0
rafamel.subtle-brackets@3.0.0
sdras.night-owl@2.0.0
tomoki1207.pdf@1.1.0
vincaslt.highlight-matching-tag@0.10.0
vscodevim.vim@1.20.1
waderyan.gitblame@6.0.2
  • Extension (VsCodeVim) version: 1.20.1
  • VSCode version: 1.55.2
  • OS: macOS

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in VS Code using the vit text object on the multiline HTML/XML/JSX examples, then trace the tag-inside selection handling in the VSCodeVim extension. Compare multiline tags with single-line tags and tags followed by trailing space; done means the selection starts at the newline after the opening tag and ends before the closing tag’s <.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.