nvimdev / nvimdev/lspsaga.nvim

Jump list is messed up by Lspsaga's finder.

Open
#1,488 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lua
Stars
3.8k
Forks
308
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Using <cmd>Lspsaga finder<cr> to jump to some references of a function. The jump list is not updated to the very first jump line, but still take itself as if it was in the original line. I guess it does not store the original line into the jump list's stack.
录屏 2024-09-01 16-42-37.webm

Steps to reproduce

Well, I can't get the minimal config with only one file. But this is the key file of lspsaga's config:

local config = function()
	require("lspsaga").setup({
		ui = {
			border = "rounded",
			lines = { "└", "├", "│", "─", "┌" },
		},
		beacon = {
			enable = false,
		},
		lightbulb = {
			enable = false,
		},
		symbol_in_winbar = {
			separator = " 🢖 ",
			folder_level = 0,
		},
		-- rename = {
		-- 	in_select = false,
		-- 	keys = { quit = "<esc>" },
		-- },
		outline = {
			close_after_jump = true,
			keys = { jump = "<CR>" },
		},
		finder = {
			keys = { toggle_or_open = "<CR>" },
		},
	})

	local keymap = vim.keymap.set

	-- lsp keymaps
	vim.api.nvim_create_autocmd("LspAttach", {
		group = vim.api.nvim_create_augroup("UserLspConfig", {}),
		callback = function(ev)
			-- Enable completion triggered by <c-x><c-o>
			vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"

			local opts = { buffer = ev.buf }
			keymap("n", "gD", "<cmd>Lspsaga finder def<cr>", opts)
			-- This conflicts with nvim-ufo --
			keymap("n", "gd", "<cmd>Lspsaga goto_definition<cr>", opts)
			-- keymap("n", "gd", vim.lsp.buf.definition, opts)
			keymap("n", "gr", "<cmd>Lspsaga finder def+imp+ref<cr>", opts)
			-- keymap("n", "gr", vim.lsp.buf.references, opts)
			keymap("n", "K", vim.lsp.buf.hover, opts)
			keymap("n", "gi", "<cmd>Lspsaga finder imp<cr>", opts)
			-- Buffer local mappings.
			-- See `:help vim.lsp.*` for documentation on any of the below functions
			-- keymap("n", "<C-k>", vim.lsp.buf.signature_help, opts)
			-- keymapis useless ↓
			-- keymapset("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
			-- keymapset("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
			-- keymapset("n", "<leader>wl", function()
			--  print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
			-- end, opts)
			-- keymap("n", "<leader>D", vim.lsp.buf.type_definition, opts)
		end,
	})
end

return {
	"nvimdev/lspsaga.nvim",
	event = "LspAttach",
	-- event = "VeryLazy",
	config = config,
	dependencies = {
		"nvim-treesitter/nvim-treesitter",
		"nvim-tree/nvim-web-devicons",
	},
}

BTW, I am using lazy.nvim as a plugin manager.

Expected behavior

Unlike the situation in the video, it should store the original jump line into the jump list and then update the jump line to the current line.

Neovim version (nvim -v)

v0.10.1

lspsaga commit

4ce44df

Terminal name/version

kitty/0.36.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the :Lspsaga finder entry point and reproduce the issue on Neovim v0.10.1 using the provided lazy.nvim configuration and lspsaga commit 4ce44df. Trace how selecting the first result interacts with Neovim's jump list; done means the original line is stored before the jump and the list points to the current line.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.