Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken rust query #513

Open
antosha417 opened this issue Oct 25, 2023 · 4 comments
Open

Broken rust query #513

antosha417 opened this issue Oct 25, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@antosha417
Copy link

Describe the bug
Hey!
I'm getting an error when opening rust files.

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/local/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/local/share/nvim/runtime/filetype.lua:25:
 BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /usr/local/share/nvim/runtime/lua/vi
m/treesitter/query.lua:259: query: invalid structure at position 5163 for language rust
stack traceback:
        [C]: in function '_ts_parse_query'
        /usr/local/share/nvim/runtime/lua/vim/treesitter/query.lua:259: 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:172: in function 'attach'
        ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:509: in function 'attach_module'
        ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:532: in function 'reattach_module'
        ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in function <...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lu
a:132>
        [C]: in function 'nvim_cmd'
        /usr/local/share/nvim/runtime/filetype.lua:25: in function </usr/local/share/nvim/runtime/filetype.lua:24>
        [C]: in function 'nvim_buf_call'
        /usr/local/share/nvim/runtime/filetype.lua:24: in function </usr/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        /usr/local/share/nvim/runtime/filetype.lua:25: in function </usr/local/share/nvim/runtime/filetype.lua:24>
        [C]: in function 'nvim_buf_call'
        /usr/local/share/nvim/runtime/filetype.lua:24: in function </usr/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        /usr/local/share/nvim/runtime/filetype.lua:24: in function </usr/local/share/nvim/runtime/filetype.lua:10>
Press ENTER or type command to continue

As far as I understand this tells me that some query is wrong. I tried to open queries for rust and saw that one of them is highlighted for some reason.

((token_tree
  "," @_start . (_) @parameter.inner)
 (#make-range! "parameter.outer" @_start @parameter.inner))
Screenshot 2023-10-25 at 18 12 01

After commenting it out I don't see an error.

To Reproduce
Steps to reproduce the behavior:

  1. Open any rust file
  2. See error

Expected behavior
No error

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~

  • OK tree-sitter found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar)
  • OK node found v18.2.0 (only needed for :TSInstallFromGrammar)
  • OK git executable found.
  • OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: Apple clang version 15.0.0 (clang-1500.0.40.1)
  • OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
machine = "arm64",
release = "22.6.0",
sysname = "Darwin",
version = "Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000"
} ~

Parser/Features H L F I J

  • bash ✓ ✓ ✓ . ✓
  • c ✓ ✓ ✓ ✓ ✓
  • comment ✓ . . . .
  • fennel ✓ ✓ ✓ . ✓
  • go ✓ ✓ ✓ ✓ ✓
  • grpcnvim ✓ . . . ✓
  • hocon ✓ . . . ✓
  • http ✓ . . . ✓
  • javascript ✓ ✓ ✓ ✓ ✓
  • json ✓ ✓ ✓ ✓ .
  • lua ✓ ✓ ✓ ✓ ✓
  • markdown ✓ . ✓ ✓ ✓
  • org ✓ . ✓ . ✓
  • proto ✓ . ✓ . .
  • python ✓ ✓ ✓ ✓ ✓
  • query ✓ ✓ ✓ ✓ ✓
  • rust ✓ ✓ ✓ ✓ ✓
  • scala ✓ ✓ ✓ . ✓
  • tlaplus ✓ ✓ ✓ . ✓
  • toml ✓ ✓ ✓ ✓ ✓
  • typescript ✓ ✓ ✓ ✓ ✓
  • vim ✓ ✓ ✓ . ✓
  • vimdoc ✓ . . . ✓
  • yaml ✓ ✓ ✓ ✓ ✓

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} ~

Output of nvim --version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Additional context
Didn't manage to fix this query myself, don't really understand what it does. But will contribute a fix if someone willing to help.

@antosha417 antosha417 added the bug Something isn't working label Oct 25, 2023
@xbladesub
Copy link

same, getting this after update

@xbladesub
Copy link

This issue happens after a7a9ba714bcc31f5453a60d48598186b6487b75c commit.
Using previous commit - 73e44f43c70289c70195b5e7bc6a077ceffddda4.

@ktrysmt
Copy link

ktrysmt commented Nov 6, 2023

I also ran into the same problem. You can avoid the error by commenting out keymaps.

      textobjects = {
        select = {
          keymaps = {
            -- ["af"] = "@function.outer",
            -- ["if"] = "@function.inner",
          },

commit hash e69a504baf2951d52e1f1fbb05145d43f236cbf1

@ananyo141
Copy link

ananyo141 commented Nov 29, 2023

This issue happens after a7a9ba714bcc31f5453a60d48598186b6487b75c commit. Using previous commit - 73e44f43c70289c70195b5e7bc6a077ceffddda4.

If anyone is using Lazy for package management, just add the commit hash while adding the plugin and sync.

  {
    'nvim-treesitter/nvim-treesitter-textobjects',
    commit = "73e44f43c70289c70195b5e7bc6a077ceffddda4",
    config = ...
  }

Mitigates the issue for now, until an upstream patch is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants