aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorGokul Soumya2022-03-08 05:25:46 +0000
committerGitHub2022-03-08 05:25:46 +0000
commit194b09fbc1edb2d0ccdadc53ec0893f61dbded8e (patch)
tree61e341c96647b254c24f59656d9856e606641707 /xtask/src
parentf31e85aca43dc7d1c5aa3e20add0f1126b112b0f (diff)
Add --health command for troubleshooting (#1669)
* Move runtime file location definitions to core * Add basic --health command * Add language specific --health * Show summary for all langs with bare --health * Use TsFeature from xtask for --health * cargo fmt Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/main.rs49
1 files changed, 6 insertions, 43 deletions
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index ad0eb16f..ad120f4f 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -3,48 +3,11 @@ use std::{env, error::Error};
type DynError = Box<dyn Error>;
pub mod helpers {
- use std::{
- fmt::Display,
- path::{Path, PathBuf},
- };
+ use std::path::{Path, PathBuf};
use crate::path;
use helix_core::syntax::Configuration as LangConfig;
-
- #[derive(Copy, Clone)]
- pub enum TsFeature {
- Highlight,
- TextObjects,
- AutoIndent,
- }
-
- impl TsFeature {
- pub fn all() -> &'static [Self] {
- &[Self::Highlight, Self::TextObjects, Self::AutoIndent]
- }
-
- pub fn runtime_filename(&self) -> &'static str {
- match *self {
- Self::Highlight => "highlights.scm",
- Self::TextObjects => "textobjects.scm",
- Self::AutoIndent => "indents.toml",
- }
- }
- }
-
- impl Display for TsFeature {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- write!(
- f,
- "{}",
- match *self {
- Self::Highlight => "Syntax Highlighting",
- Self::TextObjects => "Treesitter Textobjects",
- Self::AutoIndent => "Auto Indent",
- }
- )
- }
- }
+ use helix_term::health::TsFeature;
/// Get the list of languages that support a particular tree-sitter
/// based feature.
@@ -105,9 +68,9 @@ pub mod md_gen {
use crate::helpers;
use crate::path;
- use std::fs;
-
use helix_term::commands::TYPABLE_COMMAND_LIST;
+ use helix_term::health::TsFeature;
+ use std::fs;
pub const TYPABLE_COMMANDS_MD_OUTPUT: &str = "typable-cmd.md";
pub const LANG_SUPPORT_MD_OUTPUT: &str = "lang-support.md";
@@ -151,13 +114,13 @@ pub mod md_gen {
pub fn lang_features() -> Result<String, DynError> {
let mut md = String::new();
- let ts_features = helpers::TsFeature::all();
+ let ts_features = TsFeature::all();
let mut cols = vec!["Language".to_owned()];
cols.append(
&mut ts_features
.iter()
- .map(|t| t.to_string())
+ .map(|t| t.long_title().to_string())
.collect::<Vec<_>>(),
);
cols.push("Default LSP".to_owned());