-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Generalised to multiple runtime directories with priorities #5411
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
Changes from 5 commits
294d1a1
b642e90
c4620ff
5a0a1db
d157b74
97bbec3
8cc8b2a
4e7529a
349a4d5
93c0969
22c3cc7
0c6a824
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ pub fn general() -> std::io::Result<()> { | |
| let config_file = helix_loader::config_file(); | ||
| let lang_file = helix_loader::lang_config_file(); | ||
| let log_file = helix_loader::log_file(); | ||
| let rt_dir = helix_loader::runtime_dir(); | ||
| let rt_dirs = helix_loader::runtime_dirs(); | ||
| let clipboard_provider = get_clipboard_provider(); | ||
|
|
||
| if config_file.exists() { | ||
|
|
@@ -66,17 +66,27 @@ pub fn general() -> std::io::Result<()> { | |
| writeln!(stdout, "Language file: default")?; | ||
| } | ||
| writeln!(stdout, "Log file: {}", log_file.display())?; | ||
| writeln!(stdout, "Runtime directory: {}", rt_dir.display())?; | ||
|
|
||
| if let Ok(path) = std::fs::read_link(&rt_dir) { | ||
| let msg = format!("Runtime directory is symlinked to {}", path.display()); | ||
| writeln!(stdout, "{}", msg.yellow())?; | ||
| } | ||
| if !rt_dir.exists() { | ||
| writeln!(stdout, "{}", "Runtime directory does not exist.".red())?; | ||
| } | ||
| if rt_dir.read_dir().ok().map(|it| it.count()) == Some(0) { | ||
| writeln!(stdout, "{}", "Runtime directory is empty.".red())?; | ||
| writeln!( | ||
| stdout, | ||
| "Runtime directories: {}", | ||
| rt_dirs | ||
| .iter() | ||
| .map(|d| d.to_string_lossy()) | ||
| .collect::<Vec<_>>() | ||
| .join(";") | ||
| )?; | ||
| for rt_dir in rt_dirs.iter() { | ||
| if let Ok(path) = std::fs::read_link(&rt_dir) { | ||
| let msg = format!("Runtime directory is symlinked to: {}", path.display()); | ||
| writeln!(stdout, "{}", msg.yellow())?; | ||
| } | ||
|
||
| if !rt_dir.exists() { | ||
| let msg = format!("Runtime directory does not exist: {}", rt_dir.display()); | ||
| writeln!(stdout, "{}", msg.yellow())?; | ||
| } else if rt_dir.read_dir().ok().map(|it| it.count()) == Some(0) { | ||
| let msg = format!("Runtime directory is empty: {}", rt_dir.display()); | ||
| writeln!(stdout, "{}", msg.yellow())?; | ||
| } | ||
| } | ||
| writeln!(stdout, "Clipboard provider: {}", clipboard_provider.name())?; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,10 +280,10 @@ pub mod completers { | |
| } | ||
|
|
||
| pub fn theme(_editor: &Editor, input: &str) -> Vec<Completion> { | ||
| let mut names = theme::Loader::read_names(&helix_loader::runtime_dir().join("themes")); | ||
| names.extend(theme::Loader::read_names( | ||
| &helix_loader::config_dir().join("themes"), | ||
| )); | ||
| let mut names = theme::Loader::read_names(&helix_loader::config_dir().join("themes")); | ||
| for rt_dir in helix_loader::runtime_dirs() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the function I commented in earlier has been inlined here (maybe by the merge from master?). This function has the same issue where we might ensup with the same theme name multiple times. I think an (unstable) sort and deadup would be a good solution
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look down a couple of lines to 289 and 290 and it looks like this being done already.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah you are right, sorry about that 😅 |
||
| names.extend(theme::Loader::read_names(&rt_dir.join("themes"))); | ||
| } | ||
| names.push("default".into()); | ||
| names.push("base16_default".into()); | ||
| names.sort(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be expanded a bit, ideally we would have bullet points here that exactly lists what directories are searched in what order (and where grammars are installed by the cli)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I've also moved it down slightly in the document to try and make the flow make a bit more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a conflict with master. I've now merged in latest master and resolved the conflict.
BTW, what is the preferred process to keep these PRs up to date / conflict free with master? Should we be periodically rebasing and force pushing to our PR branch, or doing a regular merge? I was doing the former to try and keep things cleaner but then I see archseer at some point decided to do a regular merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase is preferred but if it's a small PR that we'll squash then it'll result in a single commit anyway