Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(find_root): add $ROOT environment variable detection #4363

Closed
wants to merge 1 commit into from

Conversation

zjp-CN
Copy link
Contributor

@zjp-CN zjp-CN commented Oct 19, 2022

fix #4342

You can use ROOT=$PWD hx src/main.rs to specify the project root if helix is failed to detect the unusual project structure.

fix helix-editor#4342

You can use `ROOT=$PWD hx src/main.rs` to specify the project root
if helix is failed to detect the unusual project structure.
@zjp-CN
Copy link
Contributor Author

zjp-CN commented Oct 19, 2022

This allows helix to work under any path, like
ROOT=$PWD/interactive-demo hx interactive-demo/src/main.rs or
ROOT=/rust/github/crossterm/examples/interactive-demo hx /rust/github/crossterm/examples/interactive-demo/src/main.rs.

I think the root detection rule needs to be documented in the book. I can do it.

@kirawi kirawi added A-core Area: Helix core improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Oct 25, 2022
@TotalKrill
Copy link
Contributor

This would also be a very nice CLI flag tbh, because I believe a common user pattern with CLI software is to run:

--help

and then understand some capabilities, I advocated earlier in element ( Matrix ) for having a Clap based CLI options, and this would be one of those usecases, where clap could give both discoverability, and some documentation of the feature as in a standardised way

@pascalkuthe
Copy link
Member

we ended up solving this a different way with #5748 with a project local config file instead (so you don't have to specify it on each startup). The implemented solution also allow multiple different roots for a single running helix instance (so you can still open the normal crossterm files too in your example) .Forcing all lsps to the same root with a single environment variable tends to also not work for mulpi language projects so I don't think we will be going forward with this.

@univerz
Copy link

univerz commented Jul 28, 2023

we ended up solving this a different way with #5748 with a project local config file instead

it would be great if it was possible to use it from commandline too. a typical use case is to quickly explore a few examples/foo in a big unknown project. i can do hx ., but it affects filepicker only once untill lsp starts.

@pascalkuthe
Copy link
Member

pascalkuthe commented Jul 28, 2023

We usually don't add CLI options. There isn't any CLI flrags to set config options either. You can fairly quickly open the local config file (there is even a command for it), edit the config and then reload.

This is also not about the file picker. The file picker is not affected by LSP root detection. There is already commands to open the file picker in theCWD and current buffer dir. That should be sufficient for that usecase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Helix core improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rust project: file not included in module tree
5 participants