aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorDimitris Dimitropoulos <121033874+DimitrisDimitropoulos@users.noreply.github.com>2024-06-29 09:48:43 +0300
committerGitHub <noreply@github.com>2024-06-29 14:48:43 +0800
commit5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22 (patch)
treef384113b3b580e23ca266714b6692b59d2731af6 /lua
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.tar
nvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.tar.gz
nvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.tar.bz2
nvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.tar.lz
nvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.tar.xz
nvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.tar.zst
nvim-lspconfig-5c5fd2701dfbcbafa0678dc6e85eae938dd4fa22.zip
feat(texlab): add find environments workspace command (#3225)
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/texlab.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/lua/lspconfig/server_configurations/texlab.lua b/lua/lspconfig/server_configurations/texlab.lua
index a3181764..edf250cd 100644
--- a/lua/lspconfig/server_configurations/texlab.lua
+++ b/lua/lspconfig/server_configurations/texlab.lua
@@ -101,6 +101,29 @@ local function cleanAuxiliary(bufnr)
vim.notify('Auxiliary files cleaned successfully', vim.log.levels.INFO)
end
+local function buf_find_envs(bufnr)
+ bufnr = util.validate_bufnr(bufnr)
+ local texlab_client = util.get_active_client_by_name(bufnr, 'texlab')
+ if not texlab_client then
+ return vim.notify('Texlab client not found', vim.log.levels.ERROR)
+ end
+ local pos = vim.api.nvim_win_get_cursor(0)
+ texlab_client.request('workspace/executeCommand', {
+ command = 'texlab.findEnvironments',
+ arguments = {
+ {
+ textDocument = { uri = vim.uri_from_bufnr(bufnr) },
+ position = { line = pos[1] - 1, character = pos[2] },
+ },
+ },
+ }, function(err, result)
+ if err then
+ return vim.notify(err.code .. ': ' .. err.message, vim.log.levels.ERROR)
+ end
+ return vim.notify('The environments are:\n' .. vim.inspect(result), vim.log.levels.INFO)
+ end, bufnr)
+end
+
-- bufnr isn't actually required here, but we need a valid buffer in order to
-- be able to find the client for buf_request.
-- TODO find a client by looking through buffers for a valid client?
@@ -185,6 +208,12 @@ return {
end,
description = 'Clean the auxiliary files',
},
+ TexlabFindEnvironments = {
+ function()
+ buf_find_envs(0)
+ end,
+ description = 'Find the environments at current position',
+ },
},
docs = {
description = [[