From da1f4654dc628e041b500d30392a35a62b18b16c Mon Sep 17 00:00:00 2001 From: Marten <76761713+martenmatrix@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:21:32 +0200 Subject: [PATCH 1/4] feat: add note about root_dir for nvim-lspconfig --- runtime/getting_started/setup_your_environment.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/getting_started/setup_your_environment.md b/runtime/getting_started/setup_your_environment.md index ee7629b53..b5e9aeabf 100644 --- a/runtime/getting_started/setup_your_environment.md +++ b/runtime/getting_started/setup_your_environment.md @@ -98,6 +98,15 @@ vim.lsp.config('ts_ls', { For Deno, the example above assumes a `deno.json` or `deno.jsonc` file exists at the root of the project. +If you're using `nvim-lspconfig`, you'll have to set `root_dir` for `ts_ls`. This is because `nvim-lspconfig` creates a [`root_dir`](https://github.com/neovim/nvim-lspconfig/blob/master/lsp/ts_ls.lua#L56-L68) entry and `root_markers` is [unused if root_dir is specified](https://neovim.io/doc/user/lsp.html). +```lua +vim.lsp.config('ts_ls', { + on_attach = on_attach, + root_dir = {"package.json"}, + single_file_support = false, +}) +``` + ##### Kickstart.nvim and Mason LSP If you are using [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) From c5124d0a7ae0d2daa6589be90dd16b79ce7e4005 Mon Sep 17 00:00:00 2001 From: Marten <76761713+martenmatrix@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:42:27 +0200 Subject: [PATCH 2/4] chore: format --- runtime/getting_started/setup_your_environment.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/getting_started/setup_your_environment.md b/runtime/getting_started/setup_your_environment.md index b5e9aeabf..e7a015520 100644 --- a/runtime/getting_started/setup_your_environment.md +++ b/runtime/getting_started/setup_your_environment.md @@ -98,7 +98,12 @@ vim.lsp.config('ts_ls', { For Deno, the example above assumes a `deno.json` or `deno.jsonc` file exists at the root of the project. -If you're using `nvim-lspconfig`, you'll have to set `root_dir` for `ts_ls`. This is because `nvim-lspconfig` creates a [`root_dir`](https://github.com/neovim/nvim-lspconfig/blob/master/lsp/ts_ls.lua#L56-L68) entry and `root_markers` is [unused if root_dir is specified](https://neovim.io/doc/user/lsp.html). +If you're using `nvim-lspconfig`, you'll have to set `root_dir` for `ts_ls`. +This is because `nvim-lspconfig` creates a +[`root_dir`](https://github.com/neovim/nvim-lspconfig/blob/master/lsp/ts_ls.lua#L56-L68) +entry and `root_markers` is +[unused if root_dir is specified](https://neovim.io/doc/user/lsp.html). + ```lua vim.lsp.config('ts_ls', { on_attach = on_attach, From 8ec4ceb1efc5068ef68a904eeabf3005b11300f8 Mon Sep 17 00:00:00 2001 From: Marten <76761713+martenmatrix@users.noreply.github.com> Date: Fri, 10 Oct 2025 19:10:25 +0200 Subject: [PATCH 3/4] feat: single_file_support was renamed to workspace_required --- runtime/getting_started/setup_your_environment.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/getting_started/setup_your_environment.md b/runtime/getting_started/setup_your_environment.md index e7a015520..67f04abb5 100644 --- a/runtime/getting_started/setup_your_environment.md +++ b/runtime/getting_started/setup_your_environment.md @@ -79,7 +79,7 @@ instructions to enable the Note that if you also have `ts_ls` as an LSP client, you may run into issues where both `ts_ls` and `denols` are attached to your current buffer. To resolve this, make sure to set some unique `root_dir` for both `ts_ls` and `denols`. You -may also need to set `single_file_support` to `false` for `ts_ls` to prevent it +may also need to set `workspace_required` to `true` for `ts_ls` to prevent it from running in `single file mode`. Here is an example of such a configuration: ```lua @@ -91,7 +91,7 @@ vim.lsp.config('denols', { vim.lsp.config('ts_ls', { on_attach = on_attach, root_markers = {"package.json"}, - single_file_support = false, + workspace_required = true, }) ``` @@ -108,7 +108,7 @@ entry and `root_markers` is vim.lsp.config('ts_ls', { on_attach = on_attach, root_dir = {"package.json"}, - single_file_support = false, + workspace_required = true, }) ``` From 93be8791b00add0704cded6e30bbb3fec28a487f Mon Sep 17 00:00:00 2001 From: Marten <76761713+martenmatrix@users.noreply.github.com> Date: Mon, 25 May 2026 14:34:27 +0200 Subject: [PATCH 4/4] fix: address review comments on nvim-lspconfig section - Use root_pattern() for root_dir instead of a plain table - Update Kickstart.nvim block to use workspace_required = true instead of single_file_support = false - Remove fragile line-number anchor from lsp/ts_ls.lua link --- runtime/getting_started/setup_your_environment.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/getting_started/setup_your_environment.md b/runtime/getting_started/setup_your_environment.md index 67f04abb5..b0047339c 100644 --- a/runtime/getting_started/setup_your_environment.md +++ b/runtime/getting_started/setup_your_environment.md @@ -100,14 +100,14 @@ the root of the project. If you're using `nvim-lspconfig`, you'll have to set `root_dir` for `ts_ls`. This is because `nvim-lspconfig` creates a -[`root_dir`](https://github.com/neovim/nvim-lspconfig/blob/master/lsp/ts_ls.lua#L56-L68) +[`root_dir`](https://github.com/neovim/nvim-lspconfig/blob/master/lsp/ts_ls.lua) entry and `root_markers` is [unused if root_dir is specified](https://neovim.io/doc/user/lsp.html). ```lua vim.lsp.config('ts_ls', { on_attach = on_attach, - root_dir = {"package.json"}, + root_dir = require("lspconfig").util.root_pattern("package.json"), workspace_required = true, }) ``` @@ -123,12 +123,12 @@ local servers = { -- ... some configuration ts_ls = { root_dir = require("lspconfig").util.root_pattern({ "package.json", "tsconfig.json" }), - single_file_support = false, + workspace_required = true, settings = {}, }, denols = { root_dir = require("lspconfig").util.root_pattern({"deno.json", "deno.jsonc"}), - single_file_support = false, + workspace_required = true, settings = {}, }, }