mirror of
https://github.com/neovim/neovim.git
synced 2025-12-12 01:22:41 +00:00
fix(lsp): avoid switching buffers on lsp attach (#22689)
This commit is contained in:
committed by
GitHub
parent
accdb0104e
commit
6162269fa3
@@ -1101,21 +1101,21 @@ function lsp.start_client(config)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local old_bufnr = vim.fn.bufnr('')
|
|
||||||
local last_set_from = vim.fn.gettext('\n\tLast set from ')
|
local last_set_from = vim.fn.gettext('\n\tLast set from ')
|
||||||
local line = vim.fn.gettext(' line ')
|
local line = vim.fn.gettext(' line ')
|
||||||
|
local scriptname
|
||||||
|
|
||||||
vim.cmd.buffer(bufnr)
|
vim.api.nvim_buf_call(bufnr, function()
|
||||||
local scriptname = vim.fn
|
scriptname = vim.fn
|
||||||
.execute('verbose set ' .. option .. '?')
|
.execute('verbose set ' .. option .. '?')
|
||||||
:match(last_set_from .. '(.*)' .. line .. '%d+')
|
:match(last_set_from .. '(.*)' .. line .. '%d+')
|
||||||
vim.cmd.buffer(old_bufnr)
|
end)
|
||||||
|
|
||||||
if not scriptname then
|
if not scriptname then
|
||||||
return false
|
return false
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
|
|||||||
Reference in New Issue
Block a user