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

fix(config): Don't treat ts as typoscript #912

Merged
merged 2 commits into from Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 18 additions & 8 deletions crates/typos-cli/src/default_types.rs
Expand Up @@ -39,7 +39,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
"*.p7b",
"*.p7c",
"*.p7s",
"*.pem",
// Keystore Files:
"*.key",
"*.keystore",
Expand All @@ -61,7 +60,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("creole", &["*.creole"]),
("crystal", &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
("cs", &["*.cs"]),
("csharp", &["*.cs"]),
("cshtml", &["*.cshtml"]),
("css", &["*.css", "*.scss"]),
Expand Down Expand Up @@ -99,7 +97,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("gzip", &["*.gz", "*.tgz"]),
("h", &["*.h", "*.hpp"]),
("haml", &["*.haml"]),
("haskell", &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
("hbs", &["*.hbs"]),
("hs", &["*.hs", "*.lhs"]),
("html", &["*.htm", "*.html", "*.ejs"]),
Expand Down Expand Up @@ -159,7 +156,6 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("mako", &["*.mako", "*.mao"]),
("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
("markdown", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
("matlab", &["*.m"]),
("md", &["*.markdown", "*.md", "*.mdown", "*.mkdn"]),
("meson", &["meson.build", "meson_options.txt"]),
Expand Down Expand Up @@ -265,15 +261,12 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
("ts", &["*.ts", "*.tsx"]),
("twig", &["*.twig"]),
("txt", &["*.txt"]),
("typoscript", &["*.typoscript", "*.ts"]),
("typoscript", &["*.typoscript"]),
("vala", &["*.vala"]),
("vb", &["*.vb"]),
("vcl", &["*.vcl"]),
("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]),
("vhdl", &["*.vhd", "*.vhdl"]),
("vim", &[
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
]),
("vimscript", &[
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
]),
Expand All @@ -299,3 +292,20 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("zstd", &["*.zst", "*.zstd"]),
];

// See `cargo test --lib -- --nocapture default_types::check_duplicates`
#[test]
fn check_duplicates() {
let mut reverse = std::collections::BTreeMap::new();
for (name, exts) in DEFAULT_TYPES {
for ext in *exts {
reverse.entry(ext).or_insert(Vec::new()).push(name);
}
}

for (ext, names) in reverse {
if 1 < names.len() {
println!("{ext} is under multiple names: {names:?}");
}
}
}
9 changes: 0 additions & 9 deletions crates/typos-cli/src/file_type_specifics.rs
Expand Up @@ -67,15 +67,6 @@ pub const TYPE_SPECIFIC_DICTS: &[(&str, StaticDictConfig)] = &[
ignore_words: &[],
},
),
(
"vim",
StaticDictConfig {
ignore_idents: &[
"windo", // https://vimdoc.sourceforge.net/htmldoc/windows.html#:windo
],
ignore_words: &[],
},
),
(
"vimscript",
StaticDictConfig {
Expand Down