From fe1484034f47cf064c6bfd10ef1ff26665a08fd2 Mon Sep 17 00:00:00 2001 From: alex-tdrn Date: Sat, 20 Jan 2024 14:30:05 +0100 Subject: [PATCH 01/11] feat: enable single file mode for vale_ls (#2978) as of vale 3.0.0, vale can be used with a system default `.vale.ini`, which means vale_ls can also be used in single file mode --- lua/lspconfig/server_configurations/vale_ls.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lspconfig/server_configurations/vale_ls.lua b/lua/lspconfig/server_configurations/vale_ls.lua index 8f3f249735..dab7a7fe58 100644 --- a/lua/lspconfig/server_configurations/vale_ls.lua +++ b/lua/lspconfig/server_configurations/vale_ls.lua @@ -5,6 +5,7 @@ return { cmd = { 'vale-ls' }, filetypes = { 'markdown', 'text' }, root_dir = util.root_pattern '.vale.ini', + single_file_support = true, }, docs = { description = [[ From 8917d2c830e04bf944a699b8c41f097621283828 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 20 Jan 2024 13:30:19 +0000 Subject: [PATCH 02/11] docs: update server_configurations.md skip-checks: true --- doc/server_configurations.md | 4 ++++ doc/server_configurations.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/doc/server_configurations.md b/doc/server_configurations.md index 462131b591..d2695b1cc2 100644 --- a/doc/server_configurations.md +++ b/doc/server_configurations.md @@ -11383,6 +11383,10 @@ require'lspconfig'.vale_ls.setup{} ```lua see source file ``` + - `single_file_support` : + ```lua + true + ``` ## vdmj diff --git a/doc/server_configurations.txt b/doc/server_configurations.txt index 462131b591..d2695b1cc2 100644 --- a/doc/server_configurations.txt +++ b/doc/server_configurations.txt @@ -11383,6 +11383,10 @@ require'lspconfig'.vale_ls.setup{} ```lua see source file ``` + - `single_file_support` : + ```lua + true + ``` ## vdmj From 8285447f04d75345a616a9b1e20f5b7a3d8c3ba3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 28 Jan 2024 17:05:31 -0800 Subject: [PATCH 03/11] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 67 ++------------------------- 1 file changed, 3 insertions(+), 64 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 0fe9c1f619..951e301666 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -5,73 +5,12 @@ body: - type: markdown attributes: value: | - Before reporting: search existing issues and ensure you are running the latest nightly of neovim and the latest version of nvim-lspconfig. Note that this repository implements configuration and initialization of language servers. Implementation of the language server spec itself is located in the neovim core repository. + Do NOT file bugs in this repo. The configs in this repo are unsupported and provided only as a starting point. We depend on users (like you) to troubleshoot issues with their specific LSP setups and [send improvements](https://github.com/neovim/nvim-lspconfig/blob/master/CONTRIBUTING.md). + + If you have a feature request or found a bug in the core Nvim `vim.lsp` module (not this repo), [report it to Nvim](https://github.com/neovim/neovim/issues/new?assignees=&labels=bug%2Clsp&projects=&template=lsp_bug_report.yml). - type: textarea attributes: label: "Description" description: "A short description of the problem you are reporting." validations: required: true - - type: textarea - attributes: - label: "Neovim version" - description: "Output of `nvim --version`" - placeholder: | - NVIM v0.6.0-dev+209-g0603eba6e - Build type: Release - LuaJIT 2.1.0-beta3 - validations: - required: true - - type: input - attributes: - label: "Nvim-lspconfig version" - description: "Commit hash" - placeholder: 1344a859864d4e6d23d3f3adf56d49e6386ec0d2 - - type: input - attributes: - label: "Operating system and version" - placeholder: "macOS 11.5" - validations: - required: true - - type: input - attributes: - label: "Affected language servers" - description: "If this issue is specific to one or more language servers, list them here. If not, write 'all'." - placeholder: "clangd" - validations: - required: true - - type: textarea - attributes: - label: "Steps to reproduce" - description: "Steps to reproduce using the minimal config provided below." - placeholder: | - 1. `nvim -nu minimal.lua` - 2. ... - validations: - required: true - - type: textarea - attributes: - label: "Actual behavior" - description: "Observed behavior." - validations: - required: true - - type: textarea - attributes: - label: "Expected behavior" - description: "A description of the behavior you expected." - - type: textarea - attributes: - label: "Minimal config" - render: Lua - description: "You can download a minimal_init.lua via `curl -fLO https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua`. Then edit it to include your language server and add necessary configuration and paste it here." - validations: - required: true - - type: input - attributes: - label: "LSP log" - description: "If not using the `minimal_init.lua`, add `vim.lsp.set_log_level('debug')` to your LSP setup, upload the log file at `$HOME/.cache/nvim/lsp.log` to https://gist.github.com, and paste the link here." - validations: - required: true - - - From 716dbc02cd37122f8f6ec59e54b5a979e6260a26 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 28 Jan 2024 17:07:36 -0800 Subject: [PATCH 04/11] no feature requests --- .github/ISSUE_TEMPLATE/feature_request.yml | 24 ---------------------- 1 file changed, 24 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 31f66c72e1..0000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Feature request -description: Request a feature in nvim-lspconfig -labels: [enhancement] -body: - - type: markdown - attributes: - value: | - Before requesting a new feature, search existing issues. Implementation of the language server protocol itself is located in the neovim core repository, and general feature requests may be better suited for core. - - type: input - attributes: - label: "Language server" - description: "Is the feature specific to a language server? If so, which one(s)?" - placeholder: "clangd" - - type: textarea - attributes: - label: "Requested feature" - validations: - required: true - - type: input - attributes: - label: "Other clients which have this feature" - description: "Is the feature already implemented in another LSP client for (Neo)Vim? If so, which one(s)?" - placeholder: "vim-lsp" - From 55cff4bf5fc5f413cb34f35365d99793f3ac95ae Mon Sep 17 00:00:00 2001 From: Dmitriy Gorokhov Date: Mon, 29 Jan 2024 04:14:48 +0300 Subject: [PATCH 05/11] fix(lua-language-server): update root directory search (#2842) --- lua/lspconfig/server_configurations/lua_ls.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lspconfig/server_configurations/lua_ls.lua b/lua/lspconfig/server_configurations/lua_ls.lua index 79bff16eb8..3a18838352 100644 --- a/lua/lspconfig/server_configurations/lua_ls.lua +++ b/lua/lspconfig/server_configurations/lua_ls.lua @@ -21,7 +21,7 @@ return { end root = util.root_pattern 'lua/'(fname) if root then - return root .. '/lua/' + return root end return util.find_git_ancestor(fname) end, From e2897f24a550f6c09b9cb46c77008fa929b208bd Mon Sep 17 00:00:00 2001 From: willparsons Date: Mon, 29 Jan 2024 01:17:05 +0000 Subject: [PATCH 06/11] fix(biome)!: make biome only run in projects with biome.json file (#2984) Closes #2980 This PR adjusts the configuration for the biome LSP to only attach if there is an existing biome.json found. This helps prevent conflicts in ESLint projects since biome would attach and start providing diagnostics and would format files which could conflict with the ESLint/Prettier rules that are defined. --- lua/lspconfig/server_configurations/biome.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lua/lspconfig/server_configurations/biome.lua b/lua/lspconfig/server_configurations/biome.lua index d8f144e642..dc1d1ab5fb 100644 --- a/lua/lspconfig/server_configurations/biome.lua +++ b/lua/lspconfig/server_configurations/biome.lua @@ -12,12 +12,8 @@ return { 'typescript.tsx', 'typescriptreact', }, - root_dir = function(fname) - return util.find_package_json_ancestor(fname) - or util.find_node_modules_ancestor(fname) - or util.find_git_ancestor(fname) - end, - single_file_support = true, + root_dir = util.root_pattern 'biome.json', + single_file_support = false, }, docs = { description = [[ @@ -30,7 +26,7 @@ npm install [-g] @biomejs/biome ``` ]], default_config = { - root_dir = [[root_pattern('package.json', 'node_modules', '.git', 'biome.json')]], + root_dir = [[root_pattern('biome.json')]], }, }, } From 4b73eaaf405f2e81b6022398bea5b3136e3eab10 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Jan 2024 01:17:18 +0000 Subject: [PATCH 07/11] docs: update server_configurations.md skip-checks: true --- doc/server_configurations.md | 4 ++-- doc/server_configurations.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/server_configurations.md b/doc/server_configurations.md index d2695b1cc2..5ff01d7b03 100644 --- a/doc/server_configurations.md +++ b/doc/server_configurations.md @@ -1239,11 +1239,11 @@ require'lspconfig'.biome.setup{} ``` - `root_dir` : ```lua - root_pattern('package.json', 'node_modules', '.git', 'biome.json') + root_pattern('biome.json') ``` - `single_file_support` : ```lua - true + false ``` diff --git a/doc/server_configurations.txt b/doc/server_configurations.txt index d2695b1cc2..5ff01d7b03 100644 --- a/doc/server_configurations.txt +++ b/doc/server_configurations.txt @@ -1239,11 +1239,11 @@ require'lspconfig'.biome.setup{} ``` - `root_dir` : ```lua - root_pattern('package.json', 'node_modules', '.git', 'biome.json') + root_pattern('biome.json') ``` - `single_file_support` : ```lua - true + false ``` From e20a85188e616be5ba6e7e22cd74153e8838fb85 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 28 Jan 2024 17:20:18 -0800 Subject: [PATCH 08/11] fix(mdx_analyzer): pass typescript lib as option (#2974) Per https://github.com/orgs/mdx-js/discussions/2427 and my own testing, mdx_analyzer needs a similar treatment as volar and astro to pass the typescript library into the lsp. Otherwise you get the error mentioned in that discussion. --- .../server_configurations/mdx_analyzer.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lua/lspconfig/server_configurations/mdx_analyzer.lua b/lua/lspconfig/server_configurations/mdx_analyzer.lua index d41ba84e5e..1dfbcb5a8b 100644 --- a/lua/lspconfig/server_configurations/mdx_analyzer.lua +++ b/lua/lspconfig/server_configurations/mdx_analyzer.lua @@ -1,5 +1,10 @@ local util = require 'lspconfig.util' +local function get_typescript_server_path(root_dir) + local project_root = util.find_node_modules_ancestor(root_dir) + return project_root and (util.path.join(project_root, 'node_modules', 'typescript', 'lib')) or '' +end + return { default_config = { cmd = { 'mdx-language-server', '--stdio' }, @@ -7,6 +12,14 @@ return { root_dir = util.root_pattern 'package.json', single_file_support = true, settings = {}, + init_options = { + typescript = {}, + }, + on_new_config = function(new_config, new_root_dir) + if vim.tbl_get(new_config.init_options, 'typescript') and not new_config.init_options.typescript.tsdk then + new_config.init_options.typescript.tsdk = get_typescript_server_path(new_root_dir) + end + end, }, commands = {}, docs = { From 5787aee8dd01cfdb496f8e4ede8862cd03a93bf2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Jan 2024 01:20:30 +0000 Subject: [PATCH 09/11] docs: update server_configurations.md skip-checks: true --- doc/server_configurations.md | 10 ++++++++++ doc/server_configurations.txt | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/server_configurations.md b/doc/server_configurations.md index 5ff01d7b03..281a09c70a 100644 --- a/doc/server_configurations.md +++ b/doc/server_configurations.md @@ -5918,6 +5918,16 @@ require'lspconfig'.mdx_analyzer.setup{} ```lua { "markdown.mdx" } ``` + - `init_options` : + ```lua + { + typescript = {} + } + ``` + - `on_new_config` : + ```lua + see source file + ``` - `root_dir` : ```lua see source file diff --git a/doc/server_configurations.txt b/doc/server_configurations.txt index 5ff01d7b03..281a09c70a 100644 --- a/doc/server_configurations.txt +++ b/doc/server_configurations.txt @@ -5918,6 +5918,16 @@ require'lspconfig'.mdx_analyzer.setup{} ```lua { "markdown.mdx" } ``` + - `init_options` : + ```lua + { + typescript = {} + } + ``` + - `on_new_config` : + ```lua + see source file + ``` - `root_dir` : ```lua see source file From d1d8b8a0180aafb5cf8f0454b52adb6d1e9522cb Mon Sep 17 00:00:00 2001 From: brook hong Date: Mon, 29 Jan 2024 11:58:34 +0800 Subject: [PATCH 10/11] fix: disable autostart after :LspStop #2987 Problem: The `BufReadPost` handler may autostart LSP, even after `:LspStop`. Solution: Remove the `BufReadPost` handler if there are no clients (assuming that `:LspStop` stopped them). Note: The `BufReadPost` handler will be recreated if user runs `:LspStart`. --- lua/lspconfig/configs.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua index 5056c49c2d..669e32bff6 100644 --- a/lua/lspconfig/configs.lua +++ b/lua/lspconfig/configs.lua @@ -139,6 +139,9 @@ function configs.__newindex(t, config_name, config_def) api.nvim_create_autocmd('BufReadPost', { pattern = fn.fnameescape(root_dir) .. '/*', callback = function(arg) + if #M.manager:clients() == 0 then + return true + end M.manager:try_add_wrapper(arg.buf, root_dir) end, group = lsp_group, From 021906284dcfb938bc236f8295af2650c60cb807 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 29 Jan 2024 05:16:28 +0100 Subject: [PATCH 11/11] fix(texlab): look for ".git" before ".latexmkrc" fix #2975 followup to: 995603cfaecffe10e0f4bf57f92d187f86c2de39 --- lua/lspconfig/server_configurations/texlab.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lspconfig/server_configurations/texlab.lua b/lua/lspconfig/server_configurations/texlab.lua index e24fc301c3..2cef713157 100644 --- a/lua/lspconfig/server_configurations/texlab.lua +++ b/lua/lspconfig/server_configurations/texlab.lua @@ -70,7 +70,7 @@ return { default_config = { cmd = { 'texlab' }, filetypes = { 'tex', 'plaintex', 'bib' }, - root_dir = util.root_pattern('.latexmkrc', '.git'), + root_dir = util.root_pattern('.git', '.latexmkrc'), single_file_support = true, settings = { texlab = {