Skip to content

Sorbet needs cmd_cwd #3850

@doits

Description

@doits

Description

This is about the sorbet ls: https://github.com/neovim/nvim-lspconfig/blob/61e5109c8cf24807e4ae29813a3a82b31821dd45/lsp/sorbet.lua

If I open a file while my current working directory isn't the root dir of the project, I get this error:

Sorbet's language server requires a single input directory. However, 0 are configured: []

This happens launching the language server manually, too (srb tc --lsp not in project root).

To fix it, cmd_cwd can be set, for example like this:

vim.lsp.config('sorbet', {
  cmd_cwd = vim.fs.root(0, 'Gemfile')
})

Though I am not sure why this is needed, since it should be set automatically to the root_dir if I am correct (which should be found by root_markers?):

if not new_config.cmd_cwd and vim.uv.fs_realpath(root_dir) then
new_config.cmd_cwd = root_dir
end

And I don't see any other ls config make use of cmd_cwd (can't imagine sorbet is the only ls with this requirement, or is it?).

So is cmd_cwd needed here? Or is there some other issue?

NVIM v0.11.1
Build type: Release
LuaJIT 2.1.1744318430

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions