nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.43k stars 285 forks source link

goto definition adds an extra jump to jump list #1288

Closed Glyphack closed 11 months ago

Glyphack commented 12 months ago

Describe the bug

When I use the following keymap for goto definition:

vim.keymap.set('n', 'gd', '<Cmd>Lspsaga goto_definition<CR>', opts)

the actions adds an extra jump to first line of the file is the definition is in another file. I have no problems if I change the keymap to use vim.lsp.buf.definition.

Steps to reproduce

This is my configuration, I don't have anything extra. I hope this is easy to reproduce. Otherwise I can record a video or something.

Expected behavior

I expect the jump list to not have extra jumps to line number 1. This is how my jumps look like after using goto defs. I expect the jumps to line 1 to be removed.

image

Neovim version (nvim -v)

v0.9.2

lspsaga commit

3df3e1d

Terminal name/version

wezterm 20230712-072601-f4abf8fd

glepnir commented 12 months ago

goto is rewrite handler of vim.lsp.buf.definition it added a jump list.

Glyphack commented 12 months ago

@glepnir I did not understand, do you mean that this is the intended behavior and I am configuring it incorrectly?

mycf commented 11 months ago

goto is rewrite handler of vim.lsp.buf.definition it added a jump list.

俺也一样

mycf commented 11 months ago

@glepnir 试了 最新的代码还是不行 如果第一次调用原生方法 后面不管原生方法或者lspsaga 都没有问题 如果第一次用了lspsaga的方法 原生和lspsaga的方法都有问题 跳转的时候jumplist 多了第一行的记录

glepnir commented 11 months ago

reproduce step/

Glyphack commented 11 months ago

Kapture 2023-09-30 at 14 58 56

This is my config:

    {
        "glepnir/lspsaga.nvim",
        event = "LspAttach",
        config = function()
            require("lspsaga").setup({
                ui = {
                    winblend = 10,
                    border = 'rounded',
                    colors = {
                        normal_bg = '#002b36'
                    }
                },
                symbol_in_winbar = {
                    enable = false
                }
            })
        end,
        dependencies = { { "nvim-tree/nvim-web-devicons" } }
    },