Closed PAF13 closed 2 months ago
It looks like a recent PR broke the highlights.scm. @mrdgo Do you have time to look into this? I see that _long_flag_identifier
was changed to long_flag_identifier
and I'm guessing that's what broke it since highlights.scm wasn't updated.
Interesting. Sure, I will look into this! Have you executed TSInstall nu
?
Edit: because I can't reproduce. This might happen, if you update and don't execute TSInstall nu
. Will add it to the lazy spec, so it happens automatically.
Edit2: TSUpdate
should also do the trick
Edit3: Please run TSUpdate
or TSUpdate nu
and tell me, if the error persists
I dont know yet how treesitter works so I just used TSInstall nu
and did not use TSUpdate
. It works now, thank you.
Glad to help!
Then please also update your config according to #108
But the problem is that the highlights.scm file in this repo doesn't work with the current syntax. TSInstall nu
must be using an old ... something?
No, I updated it accordingly. If you look at it, there are occurrences of long_flag_identifier
in lines 221 and 225 :)
but if i copy those .scm files to a folder that has the queries on my system, i get the same error. this is with the .scm files copied to:
This is no invalid node type: long_flag_identifier
. This is a different problem. Why do you even copy the files there? It looks as if you provoke a version conflict.
This is no
invalid node type: long_flag_identifier
. This is a different problem. Why do you even copy the files there? It looks as if you provoke a version conflict.
To validate that the *.scm files match and go along with the latest changes.
Hmm, so you take the manual installation route?
Hmm, so you take the manual installation route?
It's just a way to validate. Yes, right now I'm manually configuring tree-sitter-nu in my nvim.
Aaaah okay, then I am sorry for my provocative comment!
And you have the same config and copied the files to the location that you know for sure, are loaded by nvim? And you ran :TSUpdate nu
afterwards?
Aaaah okay ...
No worries. I didn't take it that way.
I'm not familiar with :TSUpdate nu
. What exactly does it do? Maybe update the latest tree-sitter-nu grammar?
Yes, it gets the latest version of src/parser.c
that you specify in parser_config.nu.install_info
in your nvim config, compiles it and puts the compiled binary into your tree-sitter rtp (don't ask me exactly where). This is the way to use the latest grammar.
If you copied the *.scm
files without that, then you probably ran an old parser with the new highlights, which is incompatible. Since your screenshot, there were some commits on nvim's tree-sitter plugin and you probably have a build = ":TSUpdate"
there and your problem should hopefully have been resolved :pray:
Edit: that is a funny side-note: If you "wait" for tree-sitter updates, these kinds of issues resolve themselves just because people usually rebuild their parsers when tree-sitter updates. Maybe lazy should add a build_dep
option that not only runs when the plugin updates, but also when a dependency updates. Then we wouldn't need this workaround.
Ok, I figured out that I can't be editing a nushell script when I do :TSInstall nu
because of Windows sharing violations. After doing that things look normal again. Although I'm still puzzled why the *.scm files wouldn't work. Maybe they'd work now that I did the TSInstall?
colors are a little strange though. white $variables? I wonder if that's because it's called val_variable instead of just variable?
Seems deliberate to me: We see the cursor on a variable, it being correctly identified as a variable, and styled white
Edit: h treesitter
shows
Edit2: my colorscheme allows to set overrides:
require("gruvbox").setup({ overrides = { ["@variable"] = { fg = "#d5c4a1" }}})
I am happy, that everything works again :) Yeah, when I created my first grammar and highlights, I went through a lot of pain learning the way to apply tree-sitter changes in an editor session.
If you have more questions about why and how, chat on Discord?
I am happy, that everything works again :) Yeah, when I created my first grammar and highlights, I went through a lot of pain learning the way to apply tree-sitter changes in an editor session.
If you have more questions about why and how, chat on Discord?
sounds good. thanks for the back and forth here. i'm satisfied for now since the TSInstall worked. Appreciate all your work and educating me a bit.
after adding the Lazy dependencies to my "nvim-treesitter/nvim-treesitter" script i get the error below.
I am not sure where to start looking to find the problem. My first guess is that it is compiled with zig but i cant get the other compilers to work right now.
Error in decoration provider treesitter/highlighter.win: Error executing lua: .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 221:19. Invalid node type "long_flag_identifier": (param_long_flag (long_flag_identifier) @variable.parameter) stack traceback: [C]: in function '_ts_parse_query' .../current/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn' ...vim/current/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn' ...vim/current/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get' ...nt/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:28: in function 'new' ...nt/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:240: in function 'get_query' ...nt/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:188: in function 'fn' ...t/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:491: in function 'for_each_tree' ...nt/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:175: in function 'prep