Skip to content

Conversation

@RichGuk
Copy link
Contributor

@RichGuk RichGuk commented Sep 25, 2025

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.

@RichGuk RichGuk force-pushed the set-cmd-cwd-for-ruby-lsp branch from c637b02 to edbf5a4 Compare September 25, 2025 11:13
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 neovim#3850, neovim#4082 for more details.
Tested both from root_dir and monorepo multi-root project.
@RichGuk RichGuk force-pushed the set-cmd-cwd-for-ruby-lsp branch from edbf5a4 to b553da4 Compare September 25, 2025 11:14
@RichGuk
Copy link
Contributor Author

RichGuk commented Sep 25, 2025

Previous lspconfig:

-- Launch the server in the root directory used internally by lspconfig, if otherwise unset
-- also check that the path exist
if not new_config.cmd_cwd and vim.uv.fs_realpath(root_dir) then
new_config.cmd_cwd = root_dir
end

@justinmk
Copy link
Member

justinmk commented Sep 25, 2025

Previous lspconfig:

Oh interesting. I wonder if vim.lsp.config should do that by default @lewis6991 ?

@justinmk justinmk merged commit 903045b into neovim:master Sep 25, 2025
6 checks passed
@lewis6991
Copy link
Member

Previous lspconfig:

Oh interesting. I wonder if vim.lsp.config should do that by default @lewis6991 ?

Yeah, maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants