aboutsummaryrefslogtreecommitdiffstats
path: root/lsp
diff options
context:
space:
mode:
authorIan <66728045+zspher@users.noreply.github.com>2025-10-09 20:04:45 -0600
committerGitHub <noreply@github.com>2025-10-09 19:04:45 -0700
commit1847e762eba89afc41fac7297b44df4c802286dc (patch)
treeae1932823954d83793c54007c9f4a25365913d3c /lsp
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.tar
nvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.tar.gz
nvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.tar.bz2
nvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.tar.lz
nvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.tar.xz
nvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.tar.zst
nvim-lspconfig-1847e762eba89afc41fac7297b44df4c802286dc.zip
fix(texlab): buf_change_env not taking input #4116
Problem: `buf_change_env` uses `vim.ui.input` but the input prompt value is never used for `client:exec_cmd` (due to async). Solution: Call `client:exec_cmd` in `vim.ui.input`.
Diffstat (limited to 'lsp')
-rw-r--r--lsp/texlab.lua32
1 files changed, 15 insertions, 17 deletions
diff --git a/lsp/texlab.lua b/lsp/texlab.lua
index cf6a5215..de212132 100644
--- a/lsp/texlab.lua
+++ b/lsp/texlab.lua
@@ -111,25 +111,23 @@ local function buf_find_envs(client, bufnr)
end
local function buf_change_env(client, bufnr)
- local new
vim.ui.input({ prompt = 'New environment name: ' }, function(input)
- new = input
- end)
- if not new or new == '' then
- return vim.notify('No environment name provided', vim.log.levels.WARN)
- end
- local pos = vim.api.nvim_win_get_cursor(0)
- return client:exec_cmd({
- title = 'change_environment',
- command = 'texlab.changeEnvironment',
- arguments = {
- {
- textDocument = { uri = vim.uri_from_bufnr(bufnr) },
- position = { line = pos[1] - 1, character = pos[2] },
- newName = tostring(new),
+ if not input or input == '' then
+ return vim.notify('No environment name provided', vim.log.levels.WARN)
+ end
+ local pos = vim.api.nvim_win_get_cursor(0)
+ return client:exec_cmd({
+ title = 'change_environment',
+ command = 'texlab.changeEnvironment',
+ arguments = {
+ {
+ textDocument = { uri = vim.uri_from_bufnr(bufnr) },
+ position = { line = pos[1] - 1, character = pos[2] },
+ newName = tostring(input),
+ },
},
- },
- }, { bufnr = bufnr })
+ }, { bufnr = bufnr })
+ end)
end
---@type vim.lsp.Config