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

fix(lsp): avoid switching buffers on lsp attach #22689

Merged
merged 2 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions runtime/lua/vim/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1101,21 +1101,21 @@ function lsp.start_client(config)
return true
end

local old_bufnr = vim.fn.bufnr('')
local last_set_from = vim.fn.gettext('\n\tLast set from ')
local line = vim.fn.gettext(' line ')
local scriptname

vim.cmd.buffer(bufnr)
local scriptname = vim.fn
.execute('verbose set ' .. option .. '?')
:match(last_set_from .. '(.*)' .. line .. '%d+')
vim.cmd.buffer(old_bufnr)
vim.api.nvim_buf_call(bufnr, function()
scriptname = vim.fn
.execute('verbose set ' .. option .. '?')
:match(last_set_from .. '(.*)' .. line .. '%d+')
end)

if not scriptname then
return false
end
local vimruntime = vim.fn.getenv('VIMRUNTIME')
return vim.startswith(vim.fn.expand(scriptname), vim.fn.expand(vimruntime))

return vim.startswith(vim.fn.expand(scriptname), vim.fn.expand(vim.fn.getenv('VIMRUNTIME')))
levouh marked this conversation as resolved.
Show resolved Hide resolved
end

---@private
Expand Down