Repository: helix-editor/helix (language: rust)

Issue:
Show parser availability in `--health [LANG]`
> show whether the parser is available in the `--health [LANG]` read-out

_Originally posted by @the-mikedavis in https://github.com/helix-editor/helix/issues/1853#issuecomment-1074674705_


Discussion / hints:

Fix patch:
diff --git a/helix-term/src/health.rs b/helix-term/src/health.rs
index 54789b8997a6..88e7b27be4d7 100644
--- a/helix-term/src/health.rs
+++ b/helix-term/src/health.rs
@@ -307,6 +307,8 @@ pub fn language(lang_str: String) -> std::io::Result<()> {
             .map(|formatter| formatter.command.to_string()),
     )?;
 
+    probe_parser(lang.grammar.as_ref().unwrap_or(&lang.language_id))?;
+
     for ts_feat in TsFeature::all() {
         probe_treesitter_feature(&lang_str, *ts_feat)?
     }
@@ -314,6 +316,18 @@ pub fn language(lang_str: String) -> std::io::Result<()> {
     Ok(())
 }
 
+fn probe_parser(grammar_name: &str) -> std::io::Result<()> {
+    let stdout = std::io::stdout();
+    let mut stdout = stdout.lock();
+
+    write!(stdout, "Tree-sitter parser: ")?;
+
+    match helix_loader::grammar::get_language(grammar_name) {
+        Ok(_) => writeln!(stdout, "{}", "✓".green()),
+        Err(_) => writeln!(stdout, "{}", "None".yellow()),
+    }
+}
+
 /// Display diagnostics about multiple LSPs and DAPs.
 fn probe_protocols<'a, I: Iterator<Item = &'a str> + 'a>(
     protocol_name: &str,


Test patch: