diff options
| author | Dimitris Dimitropoulos <dimitris.dimitropoulos00@gmail.com> | 2025-08-11 21:40:29 +0300 |
|---|---|---|
| committer | Dimitris Dimitropoulos <dimitris.dimitropoulos00@gmail.com> | 2025-08-11 21:45:12 +0300 |
| commit | f078a6a40b09167d35637e44a1dad7825af640cc (patch) | |
| tree | c4eec62793373ce740fafbf58fba5b46a16c06ef /lsp | |
| parent | fix(svlangserver): update config to 0.11+ (diff) | |
| download | nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.tar nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.tar.gz nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.tar.bz2 nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.tar.lz nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.tar.xz nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.tar.zst nvim-lspconfig-f078a6a40b09167d35637e44a1dad7825af640cc.zip | |
fix(texlab): update config to 0.11+
- Use bufnr and client as arguments of on_attach
- Update documentation to indicate implemented commands
Diffstat (limited to 'lsp')
| -rw-r--r-- | lsp/texlab.lua | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lsp/texlab.lua b/lsp/texlab.lua index 4fd698ca..f22239c9 100644 --- a/lsp/texlab.lua +++ b/lsp/texlab.lua @@ -5,17 +5,12 @@ --- A completion engine built from scratch for (La)TeX. --- --- See https://github.com/latex-lsp/texlab/wiki/Configuration for configuration options. - -local function client_with_fn(fn) - return function() - local bufnr = vim.api.nvim_get_current_buf() - local client = vim.lsp.get_clients({ bufnr = bufnr, name = 'texlab' })[1] - if not client then - return vim.notify(('texlab client not found in bufnr %d'):format(bufnr), vim.log.levels.ERROR) - end - fn(client, bufnr) - end -end +--- +--- There are some non standard commands supported, namely: +--- `LspTexlabBuild`, `LspTexlabForward`, `LspTexlabCancelBuild`, +--- `LspTexlabDependencyGraph`, `LspTexlabCleanArtifacts`, +--- `LspTexlabCleanAuxiliary`, `LspTexlabFindEnvironments`, +--- and `LspTexlabChangeEnvironment`. local function buf_build(client, bufnr) local win = vim.api.nvim_get_current_win() @@ -168,7 +163,9 @@ return { formatterLineLength = 80, }, }, - on_attach = function(_, buf) + ---@param client vim.lsp.Client + ---@param bufnr integer + on_attach = function(client, bufnr) for _, cmd in ipairs({ { name = 'TexlabBuild', fn = buf_build, desc = 'Build the current buffer' }, { name = 'TexlabForward', fn = buf_search, desc = 'Forward search from current position' }, @@ -179,7 +176,9 @@ return { { name = 'TexlabFindEnvironments', fn = buf_find_envs, desc = 'Find the environments at current position' }, { name = 'TexlabChangeEnvironment', fn = buf_change_env, desc = 'Change the environment at current position' }, }) do - vim.api.nvim_buf_create_user_command(buf, 'Lsp' .. cmd.name, client_with_fn(cmd.fn), { desc = cmd.desc }) + vim.api.nvim_buf_create_user_command(bufnr, 'Lsp' .. cmd.name, function() + cmd.fn(client, bufnr) + end, { desc = cmd.desc }) end end, } |
