nvimdev / lspsaga.nvim

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

Code action for source produces error #1376

Open jacobrreed opened 7 months ago

jacobrreed commented 7 months ago

Describe the bug

When using require('lspsaga.codeaction').code_action({context={only="source"}}) the plugin produces an error image

Steps to reproduce

I have the following for the lazy definition:

  {
    "nvimdev/lspsaga.nvim",
    event = { "LspAttach" },
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
    },
    config = function(opts)
      local lspsaga = require("lspsaga")
      lspsaga.setup(opts)
    end,
    keys = {
     ...
      {
        "<leader>cA",
        function()
          require("lspsaga.codeaction").code_action({ context = { only = "source" } })
        end,
        desc = "Code action (source)",
      },
    },
  },

When running it in a typescript file but could fail in others, I get an error about attempt to call method 'send_request' (a nil value)

Expected behavior

I expect the function to show Lspsaga code_action window for the source context, similar to vim.lsp.buf.code_action({context={only={"source"}, diagnostics={}}})

Neovim version (nvim -v)

NVIM v0.10.0-dev-1809+g529498685

lspsaga commit

3112b7a

Terminal name/version

Wezterm 20230712-072601-f4abf8fd

rubiin commented 6 months ago

I am facing this too @glepnir