helix icon indicating copy to clipboard operation
helix copied to clipboard

Rust project: file not included in module tree

Open zjp-CN opened this issue 3 years ago • 1 comments

I'm reading cross-term's example interactive-demo. And I open the source file with helix (master version), and get a single error from rust-analyzer file not included in module tree on the first line.

git clone https://github.com/crossterm-rs/crossterm.git
cd examples/interactive-demo
hx src/main.rs

Hover doc, autocompletion and goto-definition are not working. But you can see they work in neovim (under examples/interactive-demo too):

https://user-images.githubusercontent.com/25300418/196368208-9a35451d-b85b-4b9a-9e71-1230b69c063b.mp4

zjp-CN avatar Oct 18 '22 07:10 zjp-CN

This is the expected behavior of the current workspace detection - the crossterm repo's root is the highest directory in the git repository that has a root marker (Cargo.toml). Rust-analyzer thinks that the module isn't included because it isn't included in crossterm (which is correct) rather than the interactive-demo project. Also see https://github.com/helix-editor/helix/issues/3993, https://github.com/helix-editor/helix/issues/2732, https://github.com/helix-editor/helix/issues/2970

the-mikedavis avatar Oct 18 '22 14:10 the-mikedavis

@pascalkuthe do you think this and related issues are reasonably solved https://github.com/helix-editor/helix/pull/5748

gabydd avatar Jul 14 '23 21:07 gabydd

yeah that's fixed by that PR specifying editor.workspace-lsp-roots = ["examples/interactive-demo"] in a .helix/config.toml file inside the crossterm repo works. There is no situation to autodetect stuff like this and exactly why we ended up with the implementation in https://github.com/helix-editor/helix/pull/5748

I forgot to link this issue in that PR, thanks :+1:

pascalkuthe avatar Jul 14 '23 22:07 pascalkuthe