Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Action Error: lspsaga.nvim/lua/lspsaga/codeaction/preview.lua:104: attempt to perform arithmetic on a table value #1439

Closed
xfdj opened this issue May 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@xfdj
Copy link

xfdj commented May 12, 2024

Describe the bug

image

Steps to reproduce

My config:

return {
    -- LSP enhance experience
    {
        "nvimdev/lspsaga.nvim",
        event = "LspAttach",
        dependencies = {
            "nvim-tree/nvim-web-devicons",
            -- Please make sure you install markdown and markdown_inline parser
            "nvim-treesitter/nvim-treesitter",
        },
        keys = {
            -- LSP finder find the symbol definition implement reference
            { "<Leader>gf", "<Cmd>Lspsaga finder<CR>",      "n",                 desc = "[f]inder" },
            -- Code action
            { "<Leader>ga", "<Cmd>Lspsaga code_action<CR>", mode = { "n", "v" }, desc = "code [a]ction" },
            -- Rename
            { "<Leader>gr", "<Cmd>Lspsaga rename<CR>",      "n",                 desc = "[r]ename" },
            -- Rename word in whole project
            {
                "<Leader>gR",
                "<Cmd>Lspsaga rename ++project<CR>",
                "n",
                desc = "[R]ename in whole project",
            },
            -- hover doc
            { "<Leader>gh", "<Cmd>Lspsaga hover_doc<CR>",             "n", desc = "[h]over doc" },
            -- Peek Definition
            -- you can edit the definition file in this float window
            -- also support open/vsplit/etc operation check definition_action_keys
            -- support tagstack C-t jump back
            -- { "<Leader>gd",  "<Cmd>Lspsaga peek_definition<CR>",       "n" },
            -- Show line diagnostics
            -- you can pass argument ++unfocus to make show_line_diagnostics float window unfocus
            { "<Leader>gl", "<Cmd>Lspsaga show_line_diagnostics<CR>", "n", desc = "[l]ine diagnostics" },
            -- Toggle Outline
            { "<Leader>gs", "<Cmd>Lspsaga outline<CR>",               "n", desc = "[s]ymbol outline" },
            -- Float terminal
            -- { "<A-d>", "<Cmd>Lspsaga term_toggle<CR>", { "n", "t" } },
            -- Callhierarchy
            { "<Leader>gi", "<Cmd>Lspsaga incoming_calls<CR>",        "n", desc = "[i]ncoming calls" },
            { "<Leader>go", "<Cmd>Lspsaga outgoing_calls<CR>",        "n", desc = "[o]utgoing calls" },
            -- Diagnostic jump
            -- You can use <C-o> to jump back to your previous location
            { "[d",         "<Cmd>Lspsaga diagnostic_jump_prev<CR>",  "n", desc = "Previous [d]iagnostic" },
            { "]d",         "<Cmd>Lspsaga diagnostic_jump_next<CR>",  "n", desc = "Next [d]iagnostic" },
            -- Diagnostic jump with filters such as only jumping to an error
            {
                "[e",
                function()
                    require("lspsaga/diagnostic"):goto_prev({ severity = vim.diagnostic.severity.ERROR })
                end,
                "n",
                desc = "Previous [e]rror",
            },
            {
                "]e",
                function()
                    require("lspsaga/diagnostic"):goto_next({ severity = vim.diagnostic.severity.ERROR })
                end,
                "n",
                desc = "Next [e]rror",
            },
        },
        config = function()
            require("lspsaga").setup({
                -- Customizing Lspsaga's Appearance
                ui = {
                    -- this option only work in neovim 0.9
                    border = require("config/options").border,
                    winblend = 0,
                    expand = "瞽?,
                    collapse = "瞽?,
                    preview = "瞵?,
                    code_action = "瞟?,
                    diagnostic = "飭?,
                    incoming = "町?,
                    outgoing = "町?,
                    kind = {},
                },
                -- options for each command
                -- same as nvim-lightbulb but async
                lightbulb = {
                    enable = true,
                    sign = true,
                    virtual_text = false,
                    debounce = 1000,
                    sign_priority = 40,
                },
                finder = {
                    default = "def+tyd+imp+ref",
                    methods = {
                        tyd = "textDocument/typeDefinition",
                    },
                    keys = {
                        vsplit = "v",
                        split = "s",
                    },
                },
                code_action = {
                    show_server_name = true,
                    extend_gitsigns = true,
                    keys = {
                        quit = "q",
                        exec = "<CR>",
                    },
                },
                definition = {
                    edit = "<C-c>o",
                    vsplit = "<C-c>v",
                    split = "<C-c>i",
                    tabe = "<C-c>t",
                    quit = "q",
                },
                rename = {
                    quit = "<Esc>",
                    in_select = true,
                },
                symbol_in_winbar = {
                    enable = false,
                    separator = "飸?",
                },
                -- show outline
                outline = {},
            })
        end,
    },
}

Expected behavior

Neovim version (nvim -v)

NVIM v0.10.0-dev-2135+g98a4ed0a1 Build type: RelWithDebInfo LuaJIT 2.1.1703358377

lspsaga commit

9a06eaf

Terminal name/version

Windows Terminal 1.19.10821.0

@xfdj xfdj added the bug Something isn't working label May 12, 2024
@m1guer
Copy link

m1guer commented May 25, 2024

try comment this section on your lspsaga:

api.nvim_create_autocmd('CursorMoved', {
    buffer = self.action_bufnr,
    callback = function()
      self:set_cursor(tuples)
    end,
  })

/.local/share/nvim/lazy/lspsaga.nvim/lua/lspsaga/codeaction/init.lua

@glepnir
Copy link
Member

glepnir commented May 26, 2024

update your neovim and plugin .

@glepnir glepnir closed this as completed May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants