zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.51k stars 3.13k forks source link

`@`/`#` don't work in language word_characters when using vim `*`/`#` find under cursor #20584

Open withamoliver opened 1 week ago

withamoliver commented 1 week ago

Check for existing issues

Describe the bug / provide steps to reproduce it

  1. Add @ or# to language word_characters (or look at a JavaScript file which already includes #).
  2. Put your cursor over a word which includes a @ or # character.
  3. Find under cursor with vim */#.
  4. No matches are found.
  5. Unselecting the Use Regular Expressions option results in matches being found.

Environment

Zed: v0.160.7 (Zed) OS: macOS 14.4.1 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

No response

notpeter commented 1 week ago

What is an example search string that does not work with regex enabled? I wouldn't expect @ or # to need to be regex escaped. 🤔

What is the behavior you expect?

  1. If "Use Regular Expression" is checked it should be unchecked when triggering this.
  2. If "Use Regular Expression" is checked the search string should be regex escaped.
  3. Something else?
withamoliver commented 1 week ago

Interestingly #count and count# don't work but co#unt does. It looks like the text which ends up in the search bar converts the # to \#.

Similarly @count and count@ don't work but co@unt does, but this time there's no conversion of the text which ends up in the search bar.

The behaviour I expect is that if I put my cursor on a 'word' which includes a @ or # and use vim: move to next (* key) or use vim: move to prev (# key) then it should go to the next/prev instance of that 'word'. I don't care what ends up in the search bar or whether Use Regular Expressions is checked, I just want it to find the next instance.