Commit 0c63175
committed
fix(treesitter): make highlighting work out of the box
Two independent bugs were preventing treesitter highlighting from
attaching to .lf buffers on a fresh install:
1. Parser fallback path was not on the runtime path.
get_parser_install_dir() fell back to stdpath("data") .. "/parser"
(~/.local/share/nvim/parser), but Neovim only auto-loads parsers
from {rtp}/parser/*.so, and the user data dir itself is not in rtp —
only its "site" subdir is. The file was written to disk but Neovim
never saw it, so vim.treesitter.language.inspect("lf") kept failing.
Fall back to stdpath("data") .. "/site/parser" instead, matching
where other parsers (e.g. python, tmux) are installed. Also update
uninstall() to clean up the legacy wrong location.
2. Several query patterns referenced node fields/tokens that don't
exist in the grammar, which caused vim.treesitter.start() to throw
and disabled all highlighting:
- highlights.scm: "widthof" -> "widthof(" (token includes paren),
imported_reactor class:/alias: -> reactor_class:/name:,
key_value_pair key: -> name:
- locals.scm: imported_reactor alias: -> name:
- textobjects.scm: method body: -> code:, deadline handler: -> code:1 parent 84e26e7 commit 0c63175
4 files changed
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
514 | 515 | | |
515 | 516 | | |
516 | 517 | | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
521 | 523 | | |
522 | 524 | | |
523 | 525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
0 commit comments