aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorDimitris Dimitropoulos <dimitris.dimitropoulos00@gmail.com>2024-11-10 13:08:10 +0200
committerGitHub <noreply@github.com>2024-11-10 19:08:10 +0800
commit884d257d143b0d45bac586ad6ae2006ab6d097e2 (patch)
tree6a5a805a7ebe50f9dfcd95729a321d594fb687bc /lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.tar
nvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.tar.gz
nvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.tar.bz2
nvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.tar.lz
nvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.tar.xz
nvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.tar.zst
nvim-lspconfig-884d257d143b0d45bac586ad6ae2006ab6d097e2.zip
fix(texlab): use exec_cmd method in cleanArtifacts and cleanAuxiliary (#3428)
Problem: see #3426 and #3427
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/configs/texlab.lua32
1 files changed, 30 insertions, 2 deletions
diff --git a/lua/lspconfig/configs/texlab.lua b/lua/lspconfig/configs/texlab.lua
index ecbf0a9a..d805c3d7 100644
--- a/lua/lspconfig/configs/texlab.lua
+++ b/lua/lspconfig/configs/texlab.lua
@@ -82,9 +82,23 @@ end
local function cleanArtifacts()
local bufnr = vim.api.nvim_get_current_buf()
- if not util.get_active_client_by_name(bufnr, 'texlab') then
+ local client = util.get_active_client_by_name(bufnr, 'texlab')
+ if not client then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
+ if vim.fn.has 'nvim-0.11' == 1 then
+ return client:exec_cmd({
+ title = 'clean_artifacts',
+ command = 'texlab.cleanArtifacts',
+ arguments = { { uri = vim.uri_from_bufnr(bufnr) } },
+ }, { bufnr = bufnr }, function(err, _)
+ if err then
+ vim.notify('Failed to clean artifacts: ' .. err.message, vim.log.levels.ERROR)
+ else
+ vim.notify('Artifacts cleaned successfully', vim.log.levels.INFO)
+ end
+ end)
+ end
vim.lsp.buf.execute_command {
command = 'texlab.cleanArtifacts',
arguments = { { uri = vim.uri_from_bufnr(bufnr) } },
@@ -94,9 +108,23 @@ end
local function cleanAuxiliary()
local bufnr = vim.api.nvim_get_current_buf()
- if not util.get_active_client_by_name(bufnr, 'texlab') then
+ local client = util.get_active_client_by_name(bufnr, 'texlab')
+ if not client then
return vim.notify('Texlab client not found', vim.log.levels.ERROR)
end
+ if vim.fn.has 'nvim-0.11' == 1 then
+ return client:exec_cmd({
+ title = 'clean_auxiliary',
+ command = 'texlab.cleanAuxiliary',
+ arguments = { { uri = vim.uri_from_bufnr(bufnr) } },
+ }, { bufnr = bufnr }, function(err, _)
+ if err then
+ vim.notify('Failed to clean auxiliary files: ' .. err.message, vim.log.levels.ERROR)
+ else
+ vim.notify('Auxiliary files cleaned successfully', vim.log.levels.INFO)
+ end
+ end)
+ end
vim.lsp.buf.execute_command {
command = 'texlab.cleanAuxiliary',
arguments = { { uri = vim.uri_from_bufnr(bufnr) } },