Nvim-treesitter: Lua error with tsx `attempt to index a nil value`

Created on 15 Jul 2020  路  4Comments  路  Source: nvim-treesitter/nvim-treesitter

Describe the bug
When I open a tsx file, I keep getting this error (everytime I ignore it, it comes back the second after).

Error detected while processing CursorHold Autocommands for "<buffer=1>":
E5108: Error executing lua ...lugged/nvim-treesitter//lua/nvim-treesitter/ts_utils.lua:213: attempt to index a nil value

https://github.com/nvim-treesitter/nvim-treesitter/blob/8670df09055dce37ca9625e11e66dbe7567dfcf7/lua/nvim-treesitter/ts_utils.lua#L213

To Reproduce
Steps to reproduce the behavior:

  1. I installed the tsx parser, and added the provided default configuration from nvim-treesitter README.
  2. I opened a random tsx file
  3. I see the error all the time

Expected behavior
No error :wink:

Output of :checkhealth nvim_treesitter


health#nvim_treesitter#check

Installation

  • OK: git executable found.
  • OK: cc executable found.

typescript parser healthcheck

  • OK: typescript parser found.
  • OK: locals.scm found.
  • OK: highlights.scm found.

c parser healthcheck

  • OK: c parser found.
  • OK: locals.scm found.
  • OK: highlights.scm found.

tsx parser healthcheck

  • OK: tsx parser found.
  • OK: locals.scm found.
  • OK: highlights.scm found.

Missing parsers

  • WARNING: Some parsers are not installed:
    html
    regex
    nix
    swift
    java
    python
    yaml
    elm
    vue
    cpp
    toml
    lua
    ruby
    ocaml
    go
    scala
    haskell
    rust
    json
    markdown
    javascript
    css
    julia
    php
    c_sharp
    bash

    • ADVICE:



      • Install them using `:TSInstall language




Output of nvim --version

NVIM v0.5.0-593-g1ca67a73c
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/pierpo/projects/neovim/build/config -I/home/pierpo/projects/neovim/src -I/home/pierpo/projects/neovim/.deps/usr/include -I/usr/include -I/home/pierpo/projects/neovim/build/src/nvim/auto -I/home/pierpo/projects/neovim/build/include
Compiled by pierpo@pierpo-zotac

Thank you for all your work, this is truly awesome. Neovim will be fantastic thanks to this!

bug

All 4 comments

Hi, thanks for reporting ! And thanks for the kind words, an taking part of this journey :smile:

Can you try https://github.com/nvim-treesitter/nvim-treesitter/pull/183 to see if that fixes you issue ?

Wow, thanks for the extremely quick answer and solution!
I'll try this out tonight, many thanks!

Not sure that it solves your issue though :laughing:

Thank you again for contributing!

I found the cause and detailed it in the PR https://github.com/nvim-treesitter/nvim-treesitter/pull/183#issuecomment-658977654

Was this page helpful?
0 / 5 - 0 ratings