refactor: Move default config to default types

This commit is contained in:
Ed Page 2022-03-09 08:37:22 -06:00
parent 8cb2d44284
commit 560de68f58
2 changed files with 32 additions and 33 deletions

View file

@ -182,8 +182,7 @@ impl TypeEngineConfig {
patterns
.entry("rust".into())
.or_insert_with(|| GlobEngineConfig {
// From a spell-check perspective, these are more closely related to Rust than Toml
extend_glob: vec!["Cargo.toml".into()],
extend_glob: Vec::new(),
engine: EngineConfig {
dict: Some(DictConfig {
extend_words: maplit::hashmap! {
@ -196,40 +195,14 @@ impl TypeEngineConfig {
},
});
patterns
.entry("python".into())
.entry("cert".into())
.or_insert_with(|| GlobEngineConfig {
// From a spell-check perspective, these are more closely related to Python than Toml
extend_glob: vec!["pyproject.toml".into()],
engine: EngineConfig {
..Default::default()
},
});
patterns.entry("cert".into()).or_insert_with(|| {
GlobEngineConfig {
extend_glob: vec![
// Certificate files:
"*.crt".into(),
"*.cer".into(),
"*.ca-bundle".into(),
"*.p7b".into(),
"*.p7c".into(),
"*.p7s".into(),
"*.pem".into(),
// Keystore Files:
"*.key".into(),
"*.keystore".into(),
"*.jks".into(),
// Combined certificate and key files:
"*.p12".into(),
"*.pfx".into(),
"*.pem".into(),
],
extend_glob: Vec::new(),
engine: EngineConfig {
check_file: Some(false),
..Default::default()
},
}
});
});
patterns.into_iter()
}
}

View file

@ -31,6 +31,24 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("c", &["*.[chH]", "*.[chH].in", "*.cats"]),
("cabal", &["*.cabal"]),
("cbor", &["*.cbor"]),
("cert", &[
// Certificate files:
"*.crt",
"*.cer",
"*.ca-bundle",
"*.p7b",
"*.p7c",
"*.p7s",
"*.pem",
// Keystore Files:
"*.key",
"*.keystore",
"*.jks",
// Combined certificate and key files:
"*.p12",
"*.pfx",
"*.pem",
]),
("ceylon", &["*.ceylon"]),
("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
("cmake", &["*.cmake", "CMakeLists.txt"]),
@ -170,7 +188,11 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
("puppet", &["*.erb", "*.pp", "*.rb"]),
("purs", &["*.purs"]),
("py", &["*.py"]),
("py", &[
"*.py",
// From a spell-check perspective, this is more like Python than toml
"pyproject.toml",
]),
("qmake", &["*.pro", "*.pri", "*.prf"]),
("qml", &["*.qml"]),
("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
@ -186,7 +208,11 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
// Extensions
"*.gemspec", "*.rb", "*.rbw"
]),
("rust", &["*.rs"]),
("rust", &[
"*.rs",
// From a spell-check perspective, this is more like Python than toml
"Cargo.toml",
]),
("sass", &["*.sass", "*.scss"]),
("scala", &["*.scala", "*.sbt"]),
("sh", &[