VSCodeVim / VSCodeVim/Vim

`:%s` does not highlight in editor when using capture groups.

Open
#7,964 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

When using \( and \) to indicate a group, the matches will not be highlighted in editor.

To Reproduce

For

a = "foo"
b = "@foo"

the pattern :%s/"\(@*\)foo"/"\1baz"\g, will correctly sustitute to

a = "baz"
b = "@baz"

however the changes will not be previewed in editor.

The pattern :%s/"(@*)foo"/"\1baz"\g, will indicate the changes in editor, but produce a pattern not found error when executed.

Expected behavior

  • :%s/"\(@*\)foo"/"\1baz"\g should match in the editor.
  • :%s/"(@*)foo"/"\1baz"\g should not match in the editor.

Environment (please complete the following information):

Extension version: 1.23.2
VS Code version: Code - Insiders 1.72.0-insider (1a55beb2aaee64eb8d0cbe5b61b10088bbc6c895, 2022-09-13T05:32:07.204Z)
OS version: Darwin arm64 21.6.0
Modes:
Sandboxed: Yes

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 two substitution patterns in the VS Code Vim editor using the issue's sample text, comparing preview highlighting with executed substitution behavior. Trace the editor's substitution-preview and capture-group handling until the escaped-group pattern previews correctly and the unescaped pattern does not; verify both expected behaviors against the reported VS Code and extension versions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.