helix: Incorrect path passing for LSP server

Reproduction steps

  • Create (in my case rust) project with the name appearing somewhere higher in the path tree. e.g. /home/to266/projects/funny/some/folder/workspace/funny. If workspace literally corresponds to rust workspace, and funny inside is a rust package withing the workspace.
  • Start hx inside funny the package
  • Observe that LSP is not initialized. The logs show
2021-06-14T09:40:14.641 helix_lsp::transport [ERROR] err <- [ERROR rust_analyzer] failed to find any projects in [AbsPathBuf("/home/to266/projects/funny")]
2021-06-14T09:40:14.642 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"rust-analyzer failed to discover workspace"}}

Environment

  • Platform: Linux
  • Helix version: 0.2.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

Since both are rust projects, perhaps we could just steal some of the code

nvim-lsp uses cargo metadata --no-deps --format-version 1 to dump data then search for workspace_root. Wish it was more straightforward.

I think the procedure should be:

  1. look for the highest directory with the marker file (we have these in languages l.toml, they’re just not used currently)
  2. else look for a .git folder
  3. fallback to using current directory