Skip to content

disable additional_vim_regex_highlighting will result in E5108 in caw.vim #5464

Description

@Freed-Wu

Describe the bug

I install both caw.vim and nvim-treesitter.

If

require "nvim-treesitter.configs".setup {
    indent = { enable = true },
    highlight = { enable = true },
    textobjects = { enable = true }
}

Then vi main.c, press gcui to uncomment /* int a = 1; */:

vim.treesitter.query.get_query() is deprecated, use vim.treesitter.query.get() instead. :help deprecated
This feature will be removed in Nvim version 0.10
stack traceback:
        /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:200: in function 'get_query'
        ...cal/share/nvim/repos/github.com/tyru/caw.vim/lua/caw.lua:18: in function 'has_syntax'
        [string "luaeval()"]:1: in main chunk
[Vim(if):E5108: Error executing lua ...cal/share/nvim/repos/github.com/tyru/caw.vim/lua/caw.lua:26: attempt to index field 'hl_map' (a nil value)^@stack traceback:^@^I...cal/share/nvim/repos/github.com/tyru/caw.vim/lua/ca
w.lua:26: in function 'has_syntax'^@^I[string "luaeval()"]:1: in main chunk]::[function caw#keymapping_stub[78]..97[3]..99[1]..93[2]..92[4]..103, line 9]

However, if

require "nvim-treesitter.configs".setup {
    indent = { enable = true },
    highlight = { enable = true, additional_vim_regex_highlighting = true },
    textobjects = { enable = true }
}

E5108 will disappear.

To Reproduce

I'll try to give a minimal vimrc later...

Expected behavior

No error.

Output of :checkhealth nvim-treesitter

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

Installation ~
- OK `tree-sitter` found 0.20.8 (0c49d6745b3fc4822ab02e0018770cd6383a779c) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v20.6.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 13.2.1 20230801
- 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 = "6.5.2-arch1-1",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Wed, 06 Sep 2023 21:01:01 +0000"
} ~

Parser/Features         H L F I J
  - agda                ✓ . ✓ . .
  - astro               ✓ ✓ ✓ ✓ ✓
  - bash                x ✓ ✓ . ✓
  - beancount           ✓ . ✓ . .
  - bibtex              ✓ . ✓ ✓ .
  - blueprint           ✓ . . . .
  - c                   ✓ ✓ ✓ ✓ ✓
  - c_sharp             ✓ ✓ ✓ . ✓
  - clojure             ✓ ✓ ✓ . ✓
  - cmake               ✓ . ✓ ✓ .
  - comment             ✓ . . . .
  - commonlisp          ✓ ✓ ✓ . .
  - cooklang            ✓ . . . .
  - cpp                 ✓ ✓ ✓ ✓ ✓
  - css                 ✓ . ✓ ✓ ✓
  - cuda                ✓ ✓ ✓ ✓ ✓
  - d                   ✓ . ✓ ✓ ✓
  - dart                ✓ ✓ ✓ ✓ ✓
  - devicetree          ✓ ✓ ✓ ✓ ✓
  - diff                ✓ . . . .
  - dockerfile          ✓ . . . ✓
  - dot                 ✓ . . . ✓
  - eex                 ✓ . . . ✓
  - elixir              ✓ ✓ ✓ ✓ ✓
  - elm                 ✓ . . . ✓
  - elvish              ✓ . . . ✓
  - embedded_template   ✓ . . . ✓
  - erlang              ✓ . ✓ . .
  - fennel              ✓ ✓ ✓ . ✓
  - fish                ✓ ✓ ✓ ✓ ✓
  - foam                ✓ ✓ ✓ ✓ ✓
  - fortran             ✓ . ✓ ✓ .
  - fusion              ✓ ✓ ✓ ✓ .
  - gdscript            ✓ ✓ ✓ ✓ ✓
  - git_rebase          ✓ . . . ✓
  - gitattributes       ✓ . . . ✓
  - gitignore           ✓ . . . .
  - gleam               ✓ ✓ ✓ ✓ ✓
  - glimmer             ✓ ✓ ✓ ✓ .
  - glsl                ✓ ✓ ✓ ✓ ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - godot_resource      ✓ ✓ ✓ . .
  - gomod               ✓ . . . ✓
  - gowork              ✓ . . . ✓
  - graphql             ✓ . . ✓ ✓
  - hack                ✓ . . . .
  - haskell             ✓ . ✓ . ✓
  - hcl                 ✓ . ✓ ✓ ✓
  - heex                ✓ ✓ ✓ ✓ ✓
  - hjson               ✓ ✓ ✓ ✓ ✓
  - hlsl                ✓ ✓ ✓ ✓ ✓
  - hocon               ✓ . . . ✓
  - html                ✓ ✓ ✓ ✓ ✓
  - http                ✓ . . . ✓
  - java                ✓ ✓ ✓ ✓ ✓
  - javascript          ✓ ✓ ✓ ✓ ✓
  - jsdoc               ✓ . . . .
  - json                ✓ ✓ ✓ ✓ .
  - json5               ✓ . . . ✓
  - jsonc               ✓ ✓ ✓ ✓ ✓
  - jsonnet             ✓ ✓ ✓ . .
  - julia               ✓ ✓ ✓ ✓ ✓
  - kotlin              ✓ ✓ ✓ . ✓
  - lalrpop             ✓ ✓ . . ✓
  - latex               ✓ . ✓ . ✓
  - ledger              ✓ . ✓ ✓ ✓
  - llvm                ✓ . . . .
  - lua                 ✓ ✓ ✓ ✓ ✓
  - m68k                ✓ ✓ ✓ . ✓
  - make                ✓ . ✓ . ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - menhir              ✓ . . . ✓
  - meson               ✓ . ✓ . ✓
  - nickel              ✓ . . ✓ .
  - ninja               ✓ . ✓ ✓ .
  - nix                 ✓ ✓ ✓ . ✓
  - norg                . . . . .
  - ocaml               ✓ ✓ ✓ ✓ ✓
  - ocaml_interface     ✓ ✓ ✓ ✓ ✓
  - ocamllex            ✓ . . . ✓
  - org                 . . . . .
  - pascal              ✓ ✓ ✓ ✓ ✓
  - perl                ✓ . ✓ . ✓
  - php                 ✓ ✓ ✓ ✓ ✓
  - phpdoc              ✓ . . . .
  - pioasm              ✓ . . . ✓
  - prisma              ✓ . . . .
  - proto               ✓ . ✓ . .
  - pug                 ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - ql                  ✓ ✓ ✓ ✓ ✓
  - qmljs               ✓ . ✓ . .
  - query               ✓ ✓ ✓ ✓ ✓
  - r                   ✓ ✓ . ✓ ✓
  - racket              ✓ . ✓ . ✓
  - rasi                ✓ ✓ ✓ ✓ .
  - regex               ✓ . . . .
  - rego                ✓ . . . ✓
  - rnoweb              ✓ . ✓ . ✓
  - rst                 ✓ ✓ . . ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - scala               ✓ ✓ ✓ . ✓
  - scheme              ✓ . ✓ . ✓
  - scss                ✓ . ✓ ✓ .
  - slint               ✓ . . ✓ .
  - solidity            ✓ . . . .
  - sparql              ✓ ✓ ✓ ✓ ✓
  - sql                 ✓ . . ✓ ✓
  - supercollider       ✓ ✓ ✓ ✓ ✓
  - surface             ✓ . ✓ ✓ ✓
  - svelte              ✓ . ✓ ✓ ✓
  - swift               x ✓ . ✓ .
  - sxhkdrc             ✓ . ✓ . ✓
  - teal                ✓ ✓ ✓ ✓ ✓
  - tiger               ✓ ✓ ✓ ✓ ✓
  - tlaplus             ✓ ✓ ✓ . ✓
  - todotxt             ✓ . . . .
  - toml                ✓ ✓ ✓ ✓ ✓
  - tsx                 ✓ ✓ ✓ ✓ ✓
  - turtle              ✓ ✓ ✓ ✓ ✓
  - twig                ✓ . . . ✓
  - typescript          ✓ ✓ ✓ ✓ ✓
  - v                   ✓ ✓ ✓ ✓ ✓
  - vala                ✓ . ✓ . .
  - verilog             ✓ ✓ ✓ . ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vue                 ✓ . ✓ ✓ ✓
  - wgsl                ✓ . ✓ ✓ .
  - yaml                ✓ ✓ ✓ ✓ ✓
  - yang                ✓ . ✓ ✓ ✓
  - zig                 ✓ . ✓ ✓ ✓

  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 bash(highlights): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 242 for language bash
  bash(highlights) is concatenated from the following files:
  | [ERROR]:"/home/wzy/.local/share/nvim/repos/github.com/nvim-treesitter/nvim-treesitter/queries/bash/highlights.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 242 for language bash
- ERROR swift(highlights): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 1513 for language swift
  swift(highlights) is concatenated from the following files:
  | [ERROR]:"/home/wzy/.local/share/nvim/repos/github.com/nvim-treesitter/nvim-treesitter/queries/swift/highlights.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:259: query: invalid node type at position 1513 for language swift

Output of nvim --version

❯ vi --version
NVIM v0.9.2
Build type: Release
LuaJIT 2.1.1694285958

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

Run :checkhealth for more info

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions