nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.48k stars 287 forks source link

Getting error on goto_definition command #1178

Closed thatanjan closed 1 year ago

thatanjan commented 1 year ago

Describe the bug

I have a keymap.

local keymap = vim.keymap.set

-- Go to definition
keymap("n", "gd", "<cmd>Lspsaga goto_definition<CR>")

I get error in both js,ts, tsx.

   Error  09:16:53 অপরাহ্ণ +06 msg_show.lua_error Error executing vim.schedule lua callback: .../pack/packer/opt/lspsaga.nvim/lua/lspsaga/definition.lua:260: BufReadPost Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:21: Error executing lua: /usr/share/nvim/runtime/filetype.lua:22: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:277: query: invalid structure at position 538 for language tsx
stack traceback:
    [C]: in function '_ts_parse_query'
    /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:277: in function 'parse'
    /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:236: in function 'get_query'
    ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:108: in function 'get_query'
    ...m/site/pack/packer/start/nvim-ts-rainbow/lua/rainbow.lua:26: in function 'is_supported'
    ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:387: in function 'is_enabled'
    ...er/start/nvim-treesitter/lua/nvim-treesitter/configs.lua:507: 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.lua:132>
    [C]: in function 'nvim_cmd'
    /usr/share/nvim/runtime/filetype.lua:22: in function </usr/share/nvim/runtime/filetype.lua:21>
    [C]: in function 'nvim_buf_call'
    /usr/share/nvim/runtime/filetype.lua:21: in function </usr/share/nvim/runtime/filetype.lua:10>
    [C]: in function 'nvim_command'
    .../pack/packer/opt/lspsaga.nvim/lua/lspsaga/definition.lua:260: in function 'handler'
    /usr/share/nvim/runtime/lua/vim/lsp.lua:1514: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
    [C]: in function 'nvim_cmd'
    /usr/share/nvim/runtime/filetype.lua:22: in function </usr/share/nvim/runtime/filetype.lua:21>
    [C]: in function 'nvim_buf_call'
    /usr/share/nvim/runtime/filetype.lua:21: in function </usr/share/nvim/runtime/filetype.lua:10>
    [C]: in function 'nvim_command'
    .../pack/packer/opt/lspsaga.nvim/lua/lspsaga/definition.lua:260: in function 'handler'
    /usr/share/nvim/runtime/lua/vim/lsp.lua:1514: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
    [C]: in function 'nvim_buf_call'
    /usr/share/nvim/runtime/filetype.lua:21: in function </usr/share/nvim/runtime/filetype.lua:10>
    [C]: in function 'nvim_command'
    .../pack/packer/opt/lspsaga.nvim/lua/lspsaga/definition.lua:260: in function 'handler'
    /usr/share/nvim/runtime/lua/vim/lsp.lua:1514: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
    [C]: in function 'nvim_command'
    .../pack/packer/opt/lspsaga.nvim/lua/lspsaga/definition.lua:260: in function 'handler'
    /usr/share/nvim/runtime/lua/vim/lsp.lua:1514: in function ''
    vim/_editor.lua: in function <vim/_editor.lua:0>

image

If i remove lspsaga and use vim's built in function then I dont' get error.

Steps to reproduce

  1. You can use this simple code.
    
    // Import required modules
    const express = require('express')

// Create an instance of Express app const app = express()

// Define a route app.get('/', (req, res) => { res.send('Hello') })


2. try to go to the definition of the app variable.

### Expected behavior

No error and should jump to the definition.

### Neovim version (nvim -v)

NVIM v0.10.0-dev-679+gb60a2ab4c Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

### lspsaga commit

main branch

### Terminal name/version

kitty 0.28.1 
2Senn commented 1 year ago

Getting an error here as well: attempt to call a nil value, ../lspsaga/command.lua in function 'load_command'

glepnir commented 1 year ago

not same some command are renamed . check https://dev.neovim.pro @2Senn

glepnir commented 1 year ago

@thatanjan looks like caused by nvim-ts-rainbow ?

2Senn commented 1 year ago

Oh yup that is what it is.

Thanks!

glepnir commented 1 year ago

it write in doc just Lspsaga finder

glepnir commented 1 year ago

for my test i use this https://github.com/HiPhish/nvim-ts-rainbow2 not sure you are also use this. and test with min config it works well

Untitled