From 884d257d143b0d45bac586ad6ae2006ab6d097e2 Mon Sep 17 00:00:00 2001 From: Dimitris Dimitropoulos Date: Sun, 10 Nov 2024 13:08:10 +0200 Subject: fix(texlab): use exec_cmd method in cleanArtifacts and cleanAuxiliary (#3428) Problem: see #3426 and #3427 --- lua/lspconfig/configs/texlab.lua | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'lua') 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) } }, -- cgit v1.2.3-70-g09d2