aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
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 = [[