Skip to content

Commit

Permalink
fix(lsp): avoid switching buffers on lsp attach (neovim#22689)
Browse files Browse the repository at this point in the history
  • Loading branch information
levouh authored and folke committed May 22, 2023
1 parent 6f731e4 commit d8dde79
Showing 1 changed file with 8 additions and 8 deletions.
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('$VIMRUNTIME'))
end

---@private
Expand Down

0 comments on commit d8dde79

Please sign in to comment.