diff options
| author | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-05-21 13:36:06 +0000 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-05-21 13:36:06 +0000 |
| commit | 4dbd011c6051ce640a6030b473055368ede96216 (patch) | |
| tree | d385ea9c7c677038fcb245f9e641202b9e520d73 /doc | |
| parent | docs(eslint): update on_attach example #3844 (diff) | |
| download | nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.tar nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.tar.gz nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.tar.bz2 nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.tar.lz nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.tar.xz nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.tar.zst nvim-lspconfig-4dbd011c6051ce640a6030b473055368ede96216.zip | |
docs: update configs.md
skip-checks: true
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/configs.md | 17 | ||||
| -rw-r--r-- | doc/configs.txt | 17 |
2 files changed, 20 insertions, 14 deletions
diff --git a/doc/configs.md b/doc/configs.md index 8dd22e96..da122980 100644 --- a/doc/configs.md +++ b/doc/configs.md @@ -3690,14 +3690,17 @@ It can be installed via `npm`: npm i -g vscode-langservers-extracted ``` -`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save: +The default `on_attach` config provides the `LspEslintFixAll` command that can be used to format a document on save: ```lua -vim.lsp.config('eslint', { - --- ... +local base_on_attach = vim.lsp.config.eslint.on_attach +vim.lsp.config("eslint", { on_attach = function(client, bufnr) + if not base_on_attach then return end + + base_on_attach(client, bufnr) vim.api.nvim_create_autocmd("BufWritePre", { buffer = bufnr, - command = "EslintFixAll", + command = "LspEslintFixAll", }) end, }) @@ -3715,7 +3718,7 @@ vim.lsp.enable('eslint') ``` Default config: -- `before_init`: [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `before_init`: [../lsp/eslint.lua:37](../lsp/eslint.lua#L37) - `cmd` : ```lua { "vscode-eslint-language-server", "--stdio" } @@ -3733,8 +3736,8 @@ Default config: ["eslint/probeFailed"] = <function 4> } ``` -- `on_attach`: [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) -- `root_dir`: [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `on_attach`: [../lsp/eslint.lua:37](../lsp/eslint.lua#L37) +- `root_dir`: [../lsp/eslint.lua:37](../lsp/eslint.lua#L37) - `settings` : ```lua { diff --git a/doc/configs.txt b/doc/configs.txt index 15117431..f546772a 100644 --- a/doc/configs.txt +++ b/doc/configs.txt @@ -2538,13 +2538,16 @@ It can be installed via `npm`: >sh npm i -g vscode-langservers-extracted -`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save >lua - vim.lsp.config('eslint', { - --- ... +The default `on_attach` config provides the `LspEslintFixAll` command that can be used to format a document on save >lua + local base_on_attach = vim.lsp.config.eslint.on_attach + vim.lsp.config("eslint", { on_attach = function(client, bufnr) + if not base_on_attach then return end + + base_on_attach(client, bufnr) vim.api.nvim_create_autocmd("BufWritePre", { buffer = bufnr, - command = "EslintFixAll", + command = "LspEslintFixAll", }) end, }) @@ -2560,7 +2563,7 @@ Snippet to enable the language server: >lua Default config: -- before_init (use "gF" to view): ../lsp/eslint.lua:34 +- before_init (use "gF" to view): ../lsp/eslint.lua:37 - cmd: >lua { "vscode-eslint-language-server", "--stdio" } - filetypes: >lua @@ -2572,8 +2575,8 @@ Default config: ["eslint/openDoc"] = <function 3>, ["eslint/probeFailed"] = <function 4> } -- on_attach (use "gF" to view): ../lsp/eslint.lua:34 -- root_dir (use "gF" to view): ../lsp/eslint.lua:34 +- on_attach (use "gF" to view): ../lsp/eslint.lua:37 +- root_dir (use "gF" to view): ../lsp/eslint.lua:37 - settings: >lua { codeAction = { |
