Why did my Neovim F# tree-sitter config break? #82
-
I was facing some issues over the last few days when using Neovim to work with F# files. In particular, I was seeing errors like this:
Eventually I realised that perhaps updating the tree-sitter query files might help. I noticed that I'm still pretty new to Neovim and tree-sitter, so I'm not certain exactly how a setup that was working broke. My guess is the following: I updated to a newer version of Can you confirm that that's likely what happened? In particular, were there breaking changes in a recent update to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The breaking changes are entirely on me 😄 The node types are defined by the grammar and must match the node types used in the queries. As to how this happened: When ever you update To avoid getting surprised by this you can pin the revision of the parser like so: local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.fsharp = {
install_info = {
url = 'https://github.com/ionide/tree-sitter-fsharp',
branch = 'main',
revision = 'some git sha',
files = { 'src/scanner.c', 'src/parser.c' },
},
requires_generate_from_grammar = false,
filetype = 'fsharp',
} |
Beta Was this translation helpful? Give feedback.
The breaking changes are entirely on me 😄
The node types are defined by the grammar and must match the node types used in the queries.
If a query references a node that the grammar does not expose, then you get an error like the one your posted.
As to how this happened: When ever you update
nvim-treesitter
it run:TSUpdate
which updates all parsers to their latest version. If there has been a breaking change to the grammar since you last updated, then your queries will break.To avoid getting surprised by this you can pin the revision of the parser like so: