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 with diagnostic #1433

Closed
Gitfz810 opened this issue May 2, 2024 · 5 comments · Fixed by #1453
Closed

Code action error with diagnostic #1433

Gitfz810 opened this issue May 2, 2024 · 5 comments · Fixed by #1453
Labels
bug Something isn't working

Comments

@Gitfz810
Copy link
Contributor

Gitfz810 commented May 2, 2024

Describe the bug

Use 'o' to call code action with diagnostic failed.

image

Steps to reproduce

go version: 1.22.2
language_file:
main.go

package main

import (
	"fmt"
	"io/ioutil"
)

func mian() {
	_, err := ioutil.ReadFile("./file.txt")
	if err != nil {
		fmt.Println(err)
	}
}

saga.lua

return {
  "nvimdev/lspsaga.nvim",
  dependencies = {
    "nvim-treesitter/nvim-treesitter", -- optional
    "nvim-tree/nvim-web-devicons", -- optional
  },
  event = "BufReadPre",
  config = function()
    local setup, saga = pcall(require, "lspsaga")
    if not setup then
      return
    end

    saga.setup({
      -- when there has code action it will show a lightbulb
      lightbulb = {
        enable = false,
        sign = false,
      },
      beacon = {
        enable = false,
      },
      finder = {
        keys = {
          toggle_or_open = "<CR>",
          quit = "q",
          close = "<ESC>",
        },
      },
      rename = {
        in_select = false,
      },
      definition = {
        keys = {
          tabnew = "<C-c>n",
        },
      },
    })
  end,
}

Expected behavior

use code action success.

Neovim version (nvim -v)

NVIM v0.9.5

lspsaga commit

"lspsaga.nvim": { "branch": "main", "commit": "052234296f13e2705d5d290c7bd5a36d3dd81fde" }

Terminal name/version

terminal

@Gitfz810 Gitfz810 added the bug Something isn't working label May 2, 2024
@Miguerfi
Copy link

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

please update plugin first... your version too old

@glepnir glepnir closed this as completed May 26, 2024
@Gitfz810
Copy link
Contributor Author

I update lspsage to the newest version, commit 59d4648; but it still error.

Use action number to execute is ok; but jump to the float window and use 'o' to execute action failed.

@Gitfz810
Copy link
Contributor Author

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

thx, but it's not the codeaction error, error message show the diagnostic's close_win method is nil.

@Gitfz810
Copy link
Contributor Author

I found the close_win method is not implemented for the diag variable, and comment the close_win method at 161 still error.

image

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

Successfully merging a pull request may close this issue.

3 participants