SmiteshP/nvim-gps

Error with lua files

lizalc opened this issue · 2 comments

I'm encountering this startup error when opening a lua file:

Error detected while processing FileType Autocommands for "*":
E5108: Error executing lua ...-de6f923/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 20
stack traceback:
        [C]: in function '_ts_parse_query'
        ...-de6f923/share/nvim/runtime/lua/vim/treesitter/query.lua:172: in function 'get_query'
        ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:91: in function 'get_query'
        ...ite/pack/packer/start/nvim-gps/lua/nvim-gps/internal.lua:11: in function 'is_supported'
        ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:349: in function 'is_enabled'
        ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:456: in function 'attach_module'
        ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:481: in function 'reattach_module'
        [string ":lua"]:1: in main chunk

Running :lua print(require('nvim-gps').is_available()) once loaded return true. Running :lua print(require('nvim-gps').get_location()) returns the same error as above.

nvim-gps does work great for other files, such as bash scripts.

Neovim version:

:version
NVIM v0.7.0-dev+906-gde6f9233e
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by liza@local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-de6f923/share/nvim"

Minimal init.lua

Here is a minimal init.lua which reproduces the error for me:

local packer = require('packer')
packer.init()
packer.reset()

packer.startup({
    function(use)
        use('wbthomason/packer.nvim')

        use({
            'nvim-treesitter/nvim-treesitter',
            run = ':TSUpdate',
        })

        use({
            'nvim-lualine/lualine.nvim',
            requires = { { 'kyazdani42/nvim-web-devicons', opt = true } },
        })

        use({
            'SmiteshP/nvim-gps',
            requires = 'nvim-treesitter/nvim-treesitter',
        })
    end,
})

require('nvim-treesitter.configs').setup({
    ensure_installed = 'maintained',
    highlight = {
        enable = true,
        additional_vim_regex_highlighting = false,
    },
})

local gps = require('nvim-gps')
gps.setup()

require('lualine').setup({
    sections = { lualine_c = { { gps.get_location, cond = gps.is_available } } },
})

FYI, this is due to a breaking nvim-treesitter change: nvim-treesitter/nvim-treesitter#2293

I rewrote all the lua queries according to the new parser. Hope this solves the issue for everyone :)