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

feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap #1131

Merged
merged 2 commits into from
Jul 15, 2023

Conversation

leisurelicht
Copy link
Contributor

@leisurelicht leisurelicht commented Jul 14, 2023

jump to existing window if buffer is already opened when the builtin.lsp_definitions, builtin.lsp_type_definitions and builtin.lsp_implementations only return one result.

nvim-telescope/telescope.nvim#2454 (comment)

@@ -5,6 +5,8 @@ M._keys = nil

---@return (LazyKeys|{has?:string})[]
function M.get()
local telescope = require("telescope.builtin")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please inline the require, otherwise Telescope will always be loaded whenever an lsp attaches

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@leisurelicht leisurelicht requested a review from folke July 14, 2023 17:07
@@ -16,11 +14,11 @@ function M.get()
M._keys = {
{ "<leader>cd", vim.diagnostic.open_float, desc = "Line Diagnostics" },
{ "<leader>cl", "<cmd>LspInfo<cr>", desc = "Lsp Info" },
{ "gd", function() telescope.lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" },
{ "gd", function() require("telescope.builtin").lsp_definitions({ reuse_win = true }) end, desc = "Goto Definition", has = "definition" },
{ "gr", "<cmd>Telescope lsp_references<cr>", desc = "References" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also wok for lsp references?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, lsp references does not support the 'reuse_win' option.

@folke folke merged commit 1b0b6eb into LazyVim:main Jul 15, 2023
3 checks passed
dpetka2001 pushed a commit to dpetka2001/LazyVim that referenced this pull request Jul 18, 2023
…azyVim#1131)

* feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap

* fix: inline telescope require
joshmedeski pushed a commit to joshmedeski/LazyVim that referenced this pull request Sep 1, 2023
…azyVim#1131)

* feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap

* fix: inline telescope require
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants