After updating my neovim setup I get the following error
My guess is I am not alone here (?)
Searching a bit around I think a fix is already available from this commit
committed 03:30PM - 29 Oct 24 UTC
- Arrow functions cannot contain open tuples, so they should only allow
closed… assignments (like `let_statement`).
- Rename `function_expression` to `arrow_function_expression`.
But I don’t know when this will land to the latest tree-sitter release.
It looks like tree-sitter doesn’t gracefully handle versioning of 3rd party modules like julia
.
I don’t even know how to poll which tree-sitter-julia
version is installed, let alone how to instruct tree-sitter to use the newest version.
Any help ?
1 Like
goerz
November 20, 2024, 6:43pm
2
My understanding is that the parsers are locked in the nvim-treesitter
plugin (in their lockfile.json
). So you’d have to pin a version of nvim-treesitter
that has the julia parser you want, or potentially look into an advanced setup .
What syntax do you have in your .jl
file that triggers this error? I’m on nvim-treesitter v0.9.3
, and I’m haven’t seen any issues.
aris
November 21, 2024, 9:25am
4
Same issue for me
It seems julia is no longer ticked on the list of supported languages .
I am running on neovim v0.10.2
and the latest nvim-treesitter commit 8a74ac9a
with the lockfile.jl
showing the latest tree-sitter-julia
commit e01c928d11375513138a175a68485c4d53e55ea9
.
I have uninstalled/installed tree-sitter plugin several times.
Just starting an empty .jl
file is enough
I’m on nvim-treesitter v0.9.3
, and I’m haven’t seen any issues.
@goerz just curious… what plugin manager are you using and how did you identify the version?
I don’t know why, but I had the following Lazy configuration for nvim-treesitter
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
},
The current version of nvim-treesitter/nvim-treesitter-textobjects
has the following line
which provokes the error.
I just deleted nvim-treesitter/nvim-treesitter-textobjects
from the dependency and uninstalled and now I don’t get the error.
There is also an issue open
opened 03:18AM - 16 Nov 24 UTC
bug
**Describe the bug**
Whenever opening a julia file, I get the error `Invalid nod… e type "function_expression"`. This error does not occur when only nvim-treesitter is active.
Explicitly, I get the following trace whenever I open a Julia file.
<details>
```
Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /opt/local/share/nvim/runtime/filetype.lua:35: Error executing lua: /opt/local/share/nvim/runtime/fi
letype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /opt/loc
al/share/nvim/runtime/lua/vim/treesitter/query.lua:252: Query error at 104:2. Invalid node type "function_expression":
(function_expression
^
stack traceback:
[C]: in function '_ts_parse_query'
/opt/local/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'fn'
/opt/local/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'fn'
/opt/local/share/nvim/runtime/lua/vim/func/_memoize.lua:58: in function 'get_query'
...r-textobjects/lua/nvim-treesitter/textobjects/shared.lua:99: in function 'available_textobjects'
...r-textobjects/lua/nvim-treesitter/textobjects/select.lua:173: in function 'attach'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...vim/lazy/nvim-treesitter/lua/nvim-treesit
ter/configs.lua:132>
[C]: in function 'nvim_cmd'
/opt/local/share/nvim/runtime/filetype.lua:36: in function </opt/local/share/nvim/runtime/filetype.lua:35>
[C]: in function 'nvim_buf_call'
/opt/local/share/nvim/runtime/filetype.lua:35: in function </opt/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function 'nvim_cmd'
/opt/local/share/nvim/runtime/filetype.lua:36: in function </opt/local/share/nvim/runtime/filetype.lua:35>
[C]: in function 'nvim_buf_call'
/opt/local/share/nvim/runtime/filetype.lua:35: in function </opt/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function 'nvim_buf_call'
/opt/local/share/nvim/runtime/filetype.lua:35: in function </opt/local/share/nvim/runtime/filetype.lua:10>
```
</details>
**Minimal-config**
<details>
```
---Install Lazy package manager.
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
{
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
ensure_installed = { 'julia' },
textobjects = {
select = {
enable = true,
keymaps = {
['af'] = '@function.outer',
['if'] = '@function.inner',
},
},
}
},
},
})
```
</details>
**To Reproduce**
Steps to reproduce the behavior:
1. In terminal, `touch test.jl`
2. With the minimal config above, `nvim test.jl`
3. See error
**Expected behavior**
No error should occur, and the plugin should work.
**Output of `:checkhealth nvim-treesitter`**
<details>
<code>
==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- WARNING `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: Apple clang version 14.0.0 (clang-1400.0.29.202)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "21.6.0",
sysname = "Darwin",
version = "Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64"
} ~
Parser/Features H L F I J
- c ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- julia ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- luadoc ✓ . . . .
- luap ✓ . . . .
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- rust ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~
</code>
</details>
**Output of `nvim --version`**
```
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1720049189
Run "nvim -V1 -v" for more info
```
**Additional context**
- I tried the troubleshooting steps [here](https://github.com/nvim-treesitter/nvim-treesitter?tab=readme-ov-file#i-get-query-error-invalid-node-type-at-position)
- I'm just taking a wild guess, since I don't know this package's code at all, but is it due to [this](https://github.com/nvim-treesitter/nvim-treesitter-textobjects/blob/3e450cd85243da99dc23ebbf14f9c70e9a0c26a4/queries/julia/textobjects.scm#L104)?
1 Like
goerz
November 21, 2024, 7:22pm
8
I’m using Lazy
as well. My configuration is at GitHub - goerz/neovimrc: My Neovim Configuration
If you ever have a problem with treesitter queries that ship with nvim-treesitter
, you can always use your own by putting them in ~/.config/nvim/queries/julia
1 Like