-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
lua/lazyvim/plugins/lsp/keymaps.lua
Outdated
@@ -5,6 +5,8 @@ M._keys = nil | |||
|
|||
---@return (LazyKeys|{has?:string})[] | |||
function M.get() | |||
local telescope = require("telescope.builtin") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
@@ -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" }, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
…azyVim#1131) * feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap * fix: inline telescope require
…azyVim#1131) * feat(lsp): add 'reuse_win' for reuse window in lsp definition keymap * fix: inline telescope require
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)