aboutsummaryrefslogtreecommitdiffstats
path: root/lsp
diff options
context:
space:
mode:
authorRich Grundy <rich@grundy.io>2025-09-25 21:29:51 +0100
committerGitHub <noreply@github.com>2025-09-25 13:29:51 -0700
commit903045b001a013a1b321b1121db711820f94e588 (patch)
tree86a06eba07a9c9ba3df2dc5166f4181885f20866 /lsp
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.tar
nvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.tar.gz
nvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.tar.bz2
nvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.tar.lz
nvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.tar.xz
nvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.tar.zst
nvim-lspconfig-903045b001a013a1b321b1121db711820f94e588.zip
fix(ruby_lsp): set cmd_cwd to root_dir #4099
Problem: When running from a directory other than root (i.e monorepo), ruby-lsp does not load correctly. Unsure why, previous lspconfig had cmd_cwd set to the same as root_dir. Solution: Set the cmd_cwd via reuse_client(), similar to ast_grep. See #3850, #4082 for more details. Tested both from root_dir and monorepo multi-root project.
Diffstat (limited to 'lsp')
-rw-r--r--lsp/ruby_lsp.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/lsp/ruby_lsp.lua b/lsp/ruby_lsp.lua
index 9f32aabc..87e2f598 100644
--- a/lsp/ruby_lsp.lua
+++ b/lsp/ruby_lsp.lua
@@ -20,4 +20,8 @@ return {
init_options = {
formatter = 'auto',
},
+ reuse_client = function(client, config)
+ config.cmd_cwd = config.root_dir
+ return client.config.cmd_cwd == config.cmd_cwd
+ end,
}