Skip to content

language server roots don't search from cwd #264

Closed
@nrdxp

Description

I have noticed that the language server doesn't seem to search for the roots defined in the languages.toml file from the cwd of the shell. I've tried with rls and rust-analyzer, and both fail with the same issue. (log is from rust-analyzer attempt).

Reproduction steps

~/.config/helix/languages.toml:

[[language]]
name = "rust"
scope = "source.rust"
injection-regex = "rust"
file-types = ["rs"]
roots = ["Cargo.toml"]

language-server = { command = "rust-analyzer" }
indent = { tab-width = 4, unit = "    " }

I have an embedded rust program in an ops repo for work. If you cd into the pkgs/syncstat directory, enter the nix-shell and try to open a rust file with helix, the lsp fails to load, and the attached log specifies that it isn't searching for the Cargo.toml from the current directory, but from the git repositories root directory (two levels up).

For reference, the same workflow works fine with kakoune and kak-lsp

Environment

  • Platform: NixOS
  • Helix version: built from 1bda454 (latest at time of writing)
~/.cache/helix/helix.log
2021-06-14T12:32:21.958 helix_lsp::transport [ERROR] err <- [ERROR rust_analyzer] failed to find any projects in [AbsPathBuf("/home/nrd/git/github/input-output-hk/mantis-ops")]

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bugR-duplicateDuplicated issue: please refer to the linked issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions