`:%s` does not highlight in editor when using capture groups.
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"\gshould match in the editor. -
:%s/"(@*)foo"/"\1baz"\gshould 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
I think this is related to #3996
This only happens when "vim.enableNeovim" = true and is related to which characters are considered special (aka the magicness) and which need to be escaped.
I guess either way having two different engines parsing the same regex is asking for trouble 🎉 I implemented a quick dirty fix that flips (, ) and \\(, \\), but will not pr unless there is serious interest, because it would change the behavior of grouping when neovim is disabled.