aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorAugust Masquelier <31262046+levouh@users.noreply.github.com>2023-03-17 05:26:13 -0600
committerGitHub <noreply@github.com>2023-03-17 12:26:13 +0100
commit6162269fa3107b23fd18c6c6d0e3e8fb73cfb45e (patch)
treeab3e47f9b171a74cfde36db5faa70ccdac93d32a /runtime/lua/vim/lsp.lua
parentaccdb0104eb607a66a9908f24fbd13552d058765 (diff)
downloadrneovim-6162269fa3107b23fd18c6c6d0e3e8fb73cfb45e.tar.gz
rneovim-6162269fa3107b23fd18c6c6d0e3e8fb73cfb45e.tar.bz2
rneovim-6162269fa3107b23fd18c6c6d0e3e8fb73cfb45e.zip
fix(lsp): avoid switching buffers on lsp attach (#22689)
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 39665a3d4f..7e8c73ddb6 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -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