diff options
| author | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-04-21 16:13:57 +0000 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-04-21 16:13:57 +0000 |
| commit | 185cd59db14a16b9f884c417797a171a5ef5efff (patch) | |
| tree | 37b66a1ef7b454a2e103f524f5863e49d358edce | |
| parent | feat(eslint): add vim.lsp.config support #3731 (diff) | |
| download | nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.tar nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.tar.gz nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.tar.bz2 nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.tar.lz nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.tar.xz nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.tar.zst nvim-lspconfig-185cd59db14a16b9f884c417797a171a5ef5efff.zip | |
docs: update configs.md
skip-checks: true
| -rw-r--r-- | doc/configs.md | 97 | ||||
| -rw-r--r-- | doc/configs.txt | 95 |
2 files changed, 190 insertions, 2 deletions
diff --git a/doc/configs.md b/doc/configs.md index 9fc40717..089061f2 100644 --- a/doc/configs.md +++ b/doc/configs.md @@ -92,6 +92,7 @@ Nvim by running `:help lspconfig-all`. - [erg_language_server](#erg_language_server) - [erlangls](#erlangls) - [esbonio](#esbonio) +- [eslint](#eslint) - [facility_language_server](#facility_language_server) - [fennel_language_server](#fennel_language_server) - [fennel_ls](#fennel_ls) @@ -3577,6 +3578,100 @@ Default config: --- +## eslint + +https://github.com/hrsh7th/vscode-langservers-extracted + +`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript. +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', { + --- ... + on_attach = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + command = "EslintFixAll", + }) + end, +}) +``` + +See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options. + +Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary` + +Additional messages you can handle: `eslint/noConfig` + +Snippet to enable the language server: +```lua +require'lspconfig'.eslint.setup{} +``` + +Default config: +- `before_init` source (use "gF" to open): [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `cmd` : + ```lua + { "vscode-eslint-language-server", "--stdio" } + ``` +- `filetypes` : + ```lua + { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue", "svelte", "astro" } + ``` +- `handlers` : + ```lua + { + ["eslint/confirmESLintExecution"] = <function 1>, + ["eslint/noLibrary"] = <function 2>, + ["eslint/openDoc"] = <function 3>, + ["eslint/probeFailed"] = <function 4> + } + ``` +- `on_init` source (use "gF" to open): [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `root_dir` source (use "gF" to open): [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `settings` : + ```lua + { + codeAction = { + disableRuleComment = { + enable = true, + location = "separateLine" + }, + showDocumentation = { + enable = true + } + }, + codeActionOnSave = { + enable = false, + mode = "all" + }, + experimental = { + useFlatConfig = false + }, + format = true, + nodePath = "", + onIgnoredFiles = "off", + problems = { + shortenToSingleLine = false + }, + quiet = false, + rulesCustomizations = {}, + run = "onType", + useESLintClass = false, + validate = "on", + workingDirectory = { + mode = "location" + } + } + ``` + +--- + ## facility_language_server https://github.com/FacilityApi/FacilityLanguageServer @@ -7242,7 +7337,7 @@ Default config: ``` - `cmd` : ```lua - { "OmniSharp", "-z", "--hostPID", "1861", "DotNet:enablePackageRestore=false", "--encoding", "utf-8", "--languageserver" } + { "OmniSharp", "-z", "--hostPID", "1902", "DotNet:enablePackageRestore=false", "--encoding", "utf-8", "--languageserver" } ``` - `filetypes` : ```lua diff --git a/doc/configs.txt b/doc/configs.txt index 277cce22..4271b0db 100644 --- a/doc/configs.txt +++ b/doc/configs.txt @@ -3152,6 +3152,99 @@ Default config: ------------------------------------------------------------------------------ +eslint + +https://github.com/hrsh7th/vscode-langservers-extracted + +`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript. +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', { + --- ... + on_attach = function(client, bufnr) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = bufnr, + command = "EslintFixAll", + }) + end, +}) +``` + +See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options. + +Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary` + +Additional messages you can handle: `eslint/noConfig` + +Snippet to enable the language server: >lua + vim.lsp.enable('eslint') + + +Default config: +- `before_init` source (use "gF" to open): [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `cmd` : + ```lua + { "vscode-eslint-language-server", "--stdio" } + ``` +- `filetypes` : + ```lua + { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx", "vue", "svelte", "astro" } + ``` +- `handlers` : + ```lua + { + ["eslint/confirmESLintExecution"] = <function 1>, + ["eslint/noLibrary"] = <function 2>, + ["eslint/openDoc"] = <function 3>, + ["eslint/probeFailed"] = <function 4> + } + ``` +- `on_init` source (use "gF" to open): [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `root_dir` source (use "gF" to open): [../lsp/eslint.lua:34](../lsp/eslint.lua#L34) +- `settings` : + ```lua + { + codeAction = { + disableRuleComment = { + enable = true, + location = "separateLine" + }, + showDocumentation = { + enable = true + } + }, + codeActionOnSave = { + enable = false, + mode = "all" + }, + experimental = { + useFlatConfig = false + }, + format = true, + nodePath = "", + onIgnoredFiles = "off", + problems = { + shortenToSingleLine = false + }, + quiet = false, + rulesCustomizations = {}, + run = "onType", + useESLintClass = false, + validate = "on", + workingDirectory = { + mode = "location" + } + } + ``` + + +------------------------------------------------------------------------------ facility_language_server https://github.com/FacilityApi/FacilityLanguageServer @@ -6715,7 +6808,7 @@ Default config: ``` - `cmd` : ```lua - { "OmniSharp", "-z", "--hostPID", "1861", "DotNet:enablePackageRestore=false", "--encoding", "utf-8", "--languageserver" } + { "OmniSharp", "-z", "--hostPID", "1902", "DotNet:enablePackageRestore=false", "--encoding", "utf-8", "--languageserver" } ``` - `filetypes` : ```lua |
