-
Notifications
You must be signed in to change notification settings - Fork 28
tree_sitter_v syntax regression in an old commit #161
Description
Describe the bug
The commit f7c31c7 broke syntax highlighting for V in the helix editor; as in, after this commit, no syntax is highlighted.
Expected Behavior
V syntax highlighting in helix -- which uses the v-analizer tree sitter -- to work.
Current Behavior
All syntax highlighting for V in helix is broken with HEAD of the v-analizer tree sitter. No syntax is highlighted, all text is light gray.
Reproduction Steps
- e14fdf6 (Jul 4, 2023) -- which is the revision that the helix editor ships with -- has broken V syntax highlighting for single-quote string literals. In files with idiomatic, single-tick, string literals, the highlighter doesn't recognize the close tick and thinks everything is part of the string. This only affects single-quote string literals.
- 12ed90d (Dec 13, 2024) -- the string literal issue was at some point fixed; all syntax highlighting (so far as I can tell with some limited testing) works in this commit. It may work in other commits between e14fd and 12ed90; I did not bisect this issue.
- f7c31c7 (Dec 13, 2024), the commit made immediately after 12ed90d, breaks all V syntax highlighting in helix.
I bisected only back to the first version where all V syntax highlighting seems correct. Whatever in f7c31c that broke V highlighting is preventing helix users from using any tree-sitter past Dec 13, 2024.
To replicate, first observe the broken string literal issue. Install helix and open .v files containing idiomatic, single-tick string literals until you see the issue. Then, put this in your ~/.config/helix/languages.toml:
[[grammar]]
name="v"
source={git="https://github.com/vlang/v-analyzer", subpath="tree_sitter_v", rev="12ed90d735051ad961c54c4f0ec126354db4f966"}then run:
helix -g fetch
helix -g buildOpen the .v source where you saw the broken highlighting, and notice that it is now fixed. Now change the rev to f7c31c7578ebd35b95cfa85c6461ed6480697a9a (which is HEAD at the time I'm posting this) and run the fetch/build sequence. Then open any .v source file; all syntax highlighting will be gone. To get back proper highlighting, revert the rev # to the 12ed hash, run helix -g fetch; helix -g build and syntax highlighting will work again.
The string literal issue affected only idiomatic single-quoted string literals; if all ticks are replaced by double-quotes, highlighting works with the old, shipped grammar.
Possible Solution
I do not know enough about the languages involved to debug this.
Additional Information/Context
c.f. a related ticket on the helix project
Environment details (v doctor output)
| V full version | V 0.4.10 875c165495b0d6b607cb943ced2b3f289903cdef.875c165 |
|---|---|
| OS | linux, "EndeavourOS Linux" |
| Processor | 16 cpus, 64bit, little endian, AMD Ryzen 7 5800H with Radeon Graphics |
| Memory | 2.56GB/59.76GB |
| V executable | /home/ser/Software/v/v |
| V last modified time | 2025-05-02 21:55:21 |
| V home dir | OK, value: /home/ser/Software/v |
| VMODULES | OK, value: /home/ser/.vmodules |
| VTMP | OK, value: /tmp/v_1000 |
| Current working dir | OK, value: /home/ser/.local/share/v-analyzer |
| Git version | git version 2.49.0 |
| V git status | 875c1654 |
| .git/config present | true |
| cc version | cc (GCC) 14.2.1 20250207 |
| gcc version | gcc (GCC) 14.2.1 20250207 |
| clang version | clang version 19.1.7 |
| tcc version | tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux) |
| tcc git status | thirdparty-linux-amd64 696c1d84 |
| emcc version | N/A |
| glibc version | ldd (GNU libc) 2.41 |
Editor name
helix
v-analyzer Version
V 0.4.10 875c165
VS Code Extension Version
No response