highlights.scm errors
A report this morning in editor-support in discord had me reinstalling/recompiling tree-sitter-nu. I was presented with errors.
This changed stopped the errors but I'm not sure it's a valid change.
;(long_flag ["="] @punctuation.special)
;(short_flag ["="] @punctuation.special)
I think your highlights.scm is the latest while the grammar is not up-to-date.
TSUpdate nu says "Parsers are up-to-date!"
TSUpdate nusays "Parsers are up-to-date!"
Yes, because neovim-ts has its own copy of the parser, which is several days behind this repo.
ah, that makes sense. sorry i'm such a noob on this nvim stuff. trying to get up to speed.
3 solutions here:
- remove tree-sitter-nu completely, use all files hosted by neovim-ts
- manually specify to use the local version (which is my config for debugging) here:
config = function(_, opts)
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.nu = {
install_info = {
url = "~/.config/nushell/tree-sitter-nu", -- local path or git repo
files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
branch = "pr", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
},
filetype = "nu", -- if filetype does not match the parser name
}
require("nvim-treesitter.configs").setup(opts)
end,
- simply wait for some days, and they will sync :-).
ah, that makes sense. sorry i'm such a noob on this nvim stuff. trying to get up to speed.
This nvim-ts config is really confusing, I still don't know how to specify local queries in install_info, and updating the grammar locally is also weird.
And please keep this issue open for others facing the same problem.
After doing step 2, I still get the error. So, I copied the scm files to nvim-data and things seem to be working fine. Is there a way to tell what version of tree-sitter-nu I'm running?
@fdncred Sorry for not making it clear, actually these are exclusive solutions, not steps to follow. If you choose method 2, you still need to install tree-sitter-nu (using a plugin manager or as a dependency of nvim-ts) for its latest highlights.scm. Otherwise you're using grammar > highlight.scm, which will also cause similar problems.
And I suppose even after they upgrade the nu parser, method 1 will become problematic since it still use old highlights.scm, I may need to create a PR to nvim-ts for the change.
ya, i understood that they weren't steps. I did option 2 and got it working after i copied the scm files.
@fdncred that's weird, if you don't remove tree-sitter-nu, it should work fine (need to update to the latest) without requiring to manually copy the scm files. Manually copying just solves everything though.