diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2025-08-11 16:49:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-11 16:49:46 -0400 |
| commit | 0e3083e961a5c73854cbab381c1cbb6652cee6a6 (patch) | |
| tree | 6dd7b428c378de9e3d171da973ab5ecee0360c24 /lsp/texlab.lua | |
| parent | docs: update configs.md (diff) | |
| parent | fix(tinymist): update config to 0.11+ (diff) | |
| download | nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.tar nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.tar.gz nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.tar.bz2 nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.tar.lz nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.tar.xz nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.tar.zst nvim-lspconfig-0e3083e961a5c73854cbab381c1cbb6652cee6a6.zip | |
Merge #3993 fix: update configs to 0.11+
* fix(zk): update config to 0.11+
- Remove buf.execute_command in favor of :exec_cmd
- Set title on :exec_cmd
* fix(clangd): update config to 0.11+
- Use client and bufnr as arguments of on_attach
- Silence wrong diagnostics about unknown method
- Call request as method
- Align the style of the two functions
- Drop border setup in favor of winborder option
* fix(denols): update config to 0.11+
- Call request_sync as method
- Use vim.notify instead of nvim_err_writeln
* fix(elmls): update config to 0.11+
- Use vim.bo[bufnr] instead of nvim_buf_get_option
* fix(markdown_oxide): update config to 0.11+
- Use drop buf.execute command and use :exec_cmd
* fix(rust_analyzer): update config to 0.11+
- Call request as method
- Silence wrong diagnostic
* fix(svlangserver): update config to 0.11+
- Drop .buf.execute_command and use :exec_cmd
* fix(texlab): update config to 0.11+
- Use bufnr and client as arguments of on_attach
- Update documentation to indicate implemented commands
* fix(tinymist): update config to 0.11+
- Drop check for neovim version
- Make sure the name starts with Lsp to remove the exemption from the CI
check
Diffstat (limited to 'lsp/texlab.lua')
| -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, } |
