Skip to content

Commit 903045b

Browse files
authored
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.
1 parent 33d351c commit 903045b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lsp/ruby_lsp.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ return {
2020
init_options = {
2121
formatter = 'auto',
2222
},
23+
reuse_client = function(client, config)
24+
config.cmd_cwd = config.root_dir
25+
return client.config.cmd_cwd == config.cmd_cwd
26+
end,
2327
}

0 commit comments

Comments
 (0)