Skip to content

Neovim highlight is (sometimes) broken #222

@Tazoeur

Description

@Tazoeur

Sometimes (3 out of 4 times I'd say), instead of providing a good highliting, I have the following error instead.

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: ...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:266: ...x-x86_64/share/
nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 24:6. Invalid node type "register":
    "register"
     ^

stack traceback:
        [C]: in function 'error'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:266: in function 'get_query'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:107: in function 'set_conceal_lines'
        ...64/share/nvim/runtime/lua/vim/treesitter/highlighter.lua:146: in function 'new'
        ...m-linux-x86_64/share/nvim/runtime/lua/vim/treesitter.lua:432: in function 'start'
        ...m/lazy/nvim-treesitter/lua/nvim-treesitter/highlight.lua:20: 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-treesitter/configs.lua:132>
        [C]: in function 'nvim_cmd'
        ...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:36: in function <...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'pcall'
        vim/shared.lua: in function <vim/shared.lua:0>
        [C]: in function '_with'
        ...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:35: in function <...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function '_with'
        ...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:35: in function <...u/.opt/nvim-linux-x86_64/share/nvim/runtime/filetype.lua:10>

Here's what checkhealth nvim-treesitter provides

- ✅ OK `node` found v23.11.1 (only needed for :TSInstallFromGrammar)
- ✅ OK `git` executable found.
- ✅ OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (Ubuntu 11.4.0-1ubuntu1~22.04.2) 11.4.0
- ✅ OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.8.0-65-generic",
  sysname = "Linux",
  version = "#68~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 15 18:06:34 UTC 2"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - c_sharp             ✓ ✓ ✓ . ✓
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - csv                 ✓ . . . .
  - diff                ✓ . ✓ . ✓
  - dockerfile          ✓ . . . ✓
  - git_config          ✓ . ✓ . ✓
  - gitcommit           ✓ . . . ✓
  - gitignore           ✓ . . . ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - groovy              ✓ ✓ ✓ ✓ ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - ini                 ✓ . ✓ . ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - json                ✓ ✓ ✓ ✓ .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - luadoc              ✓ . . . .
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - nu                  x . ✓ ✓ ✓
  - properties          ✓ ✓ . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - requirements        ✓ . . . ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - sql                 ✓ . ✓ ✓ ✓
  - ssh_config          ✓ ✓ ✓ ✓ ✓
  - tmux                ✓ . . . ✓
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓
  - xml                 ✓ ✓ ✓ ✓ ✓
  - 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} ~

The following errors have been detected: ~
- ❌ ERROR nu(highlights): ...x-x86_64/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 24:6. Invalid node type "register":
      "register"
       ^

  nu(highlights) is concatenated from the following files:
  | [ERROR]:"/home/me/.local/share/nvim/lazy/nvim-nu/queries/nu/highlights.scm", failed to load: ...x-x86_64/share/nvim/runtime/lua/vim/treesitter/query.lua:373: Query error at 24:6. Invalid node type "register":
      "register"
       ^

I have relied on the TS "ensure_installed" property to install the nu parser, because I understood we shouldn't install this repository as nvim plugin anymore.

I don't really understand why sometimes it's working as intended, and sometimes I get this error...

I hope this bug report is useful, in the meantime do you think of a workaround ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions