Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sirno opened this issue Sep 14, 2022 · 2 comments
Open

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

sirno opened this issue Sep 14, 2022 · 2 comments

Comments

@sirno
Copy link

sirno commented Sep 14, 2022

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

@sirno
Copy link
Author

sirno commented Sep 14, 2022

I think this is related to #3996

@sirno
Copy link
Author

sirno commented Sep 14, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant