Closed vsoftco closed 6 months ago
Not to mention, the query says context -> nvim-treesittet-context issue
Queries for languages are community maintained, so someone who uses that language will need to fix it.
I can pinpoint the error to the function_definition
in context.scm
, see https://github.com/nvim-treesitter/nvim-treesitter-context/blob/ba05c6b753130d96b284d3e8ba8f54c28c0fb6d1/queries/julia/context.scm#L3 If I remove line 4: parameters: (_) @context.final
, it works. Unfortunately, I don't know enough about how the parser works to propose a fix.
@frankebel
I just realized that before https://github.com/nvim-treesitter/nvim-treesitter/pull/6429, :InspectTree
reveals this for a 1 argument function definition:
(function_definition)
name: (identifier)
parameters: (parameter_list)
whereas after it shows
(function_definition)
(signature)
(call_expression)
(identifier)
(argument_list)
(identifier)
So there are no more parameters
and name
nodes. Hence removing https://github.com/nvim-treesitter/nvim-treesitter-context/blob/ba05c6b753130d96b284d3e8ba8f54c28c0fb6d1/queries/julia/context.scm#L4 seems a valid fix. Waiting for someone more experienced with this to confirm before opening a PR.
@savq
If the idea is to show the whole function signature then the follow should probably work:
(function_definition
(signature) @context.final
) @context
Also, I see some query files using @context.final
and others using @context.end
. The CONTRIBUTING file mentions @context.end
. Should the Julia file be updated to use @context.end
?
Note @context.final
is inclusive, whereas @context.end
is exclusive. I need to adjust the docs to explain this.
If the idea is to show the whole function signature then the follow should probably work:
(function_definition (signature) @context.final ) @context
Also, I see some query files using
@context.final
and others using@context.end
. The CONTRIBUTING file mentions@context.end
. Should the Julia file be updated to use@context.end
?
I played around a little bit and think the suggestion by @savq is better than removing it suggested by @vsoftco. Imo showing the function signature is better and we should explicitly use @context.final
, not @context.end
.
Closed in #429
Thanks!
Describe the bug
Starting with nvim-treesitter/nvim-treesitter#6429 , I am getting this error on nvim 0.9.5 (macOS 14, Homebrew) when opening a Julia (.jl) file:
Note that 86ac7e9274535038f8f5f5f80397f0885bea0326 and all commits before work just fine.
To Reproduce
nvim test.jl
Expected behavior
I expect no errors when loading a Julia file
Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
No response