mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-13 21:26:27 +02:00
ignore/types: name aliases for file types
We also make py/python, md/markdown and ts/typescript aliases of one another. Note that this only introduces aliases at the point where default types are defined. This just makes them a bit easier to read/write, and also makes it easier to expose more names that describe the same thing. Fixes #1857, Closes #1895
This commit is contained in:
parent
7313dca472
commit
f30a30867e
@ -9,111 +9,111 @@
|
|||||||
/// Please try to keep this list sorted lexicographically and wrapped to 79
|
/// Please try to keep this list sorted lexicographically and wrapped to 79
|
||||||
/// columns (inclusive).
|
/// columns (inclusive).
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
pub const DEFAULT_TYPES: &[(&[&str], &[&str])] = &[
|
||||||
("ada", &["*.adb", "*.ads"]),
|
(&["ada"], &["*.adb", "*.ads"]),
|
||||||
("agda", &["*.agda", "*.lagda"]),
|
(&["agda"], &["*.agda", "*.lagda"]),
|
||||||
("aidl", &["*.aidl"]),
|
(&["aidl"], &["*.aidl"]),
|
||||||
("alire", &["alire.toml"]),
|
(&["alire"], &["alire.toml"]),
|
||||||
("amake", &["*.mk", "*.bp"]),
|
(&["amake"], &["*.mk", "*.bp"]),
|
||||||
("asciidoc", &["*.adoc", "*.asc", "*.asciidoc"]),
|
(&["asciidoc"], &["*.adoc", "*.asc", "*.asciidoc"]),
|
||||||
("asm", &["*.asm", "*.s", "*.S"]),
|
(&["asm"], &["*.asm", "*.s", "*.S"]),
|
||||||
("asp", &[
|
(&["asp"], &[
|
||||||
"*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs",
|
"*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs",
|
||||||
"*.ascx.vb", "*.asp"
|
"*.ascx.vb", "*.asp"
|
||||||
]),
|
]),
|
||||||
("ats", &["*.ats", "*.dats", "*.sats", "*.hats"]),
|
(&["ats"], &["*.ats", "*.dats", "*.sats", "*.hats"]),
|
||||||
("avro", &["*.avdl", "*.avpr", "*.avsc"]),
|
(&["avro"], &["*.avdl", "*.avpr", "*.avsc"]),
|
||||||
("awk", &["*.awk"]),
|
(&["awk"], &["*.awk"]),
|
||||||
("bazel", &[
|
(&["bazel"], &[
|
||||||
"*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "MODULE.bazel",
|
"*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "MODULE.bazel",
|
||||||
"WORKSPACE", "WORKSPACE.bazel",
|
"WORKSPACE", "WORKSPACE.bazel",
|
||||||
]),
|
]),
|
||||||
("bitbake", &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
|
(&["bitbake"], &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
|
||||||
("brotli", &["*.br"]),
|
(&["brotli"], &["*.br"]),
|
||||||
("buildstream", &["*.bst"]),
|
(&["buildstream"], &["*.bst"]),
|
||||||
("bzip2", &["*.bz2", "*.tbz2"]),
|
(&["bzip2"], &["*.bz2", "*.tbz2"]),
|
||||||
("c", &["*.[chH]", "*.[chH].in", "*.cats"]),
|
(&["c"], &["*.[chH]", "*.[chH].in", "*.cats"]),
|
||||||
("cabal", &["*.cabal"]),
|
(&["cabal"], &["*.cabal"]),
|
||||||
("candid", &["*.did"]),
|
(&["candid"], &["*.did"]),
|
||||||
("carp", &["*.carp"]),
|
(&["carp"], &["*.carp"]),
|
||||||
("cbor", &["*.cbor"]),
|
(&["cbor"], &["*.cbor"]),
|
||||||
("ceylon", &["*.ceylon"]),
|
(&["ceylon"], &["*.ceylon"]),
|
||||||
("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
|
(&["clojure"], &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
|
||||||
("cmake", &["*.cmake", "CMakeLists.txt"]),
|
(&["cmake"], &["*.cmake", "CMakeLists.txt"]),
|
||||||
("cml", &["*.cml"]),
|
(&["cml"], &["*.cml"]),
|
||||||
("coffeescript", &["*.coffee"]),
|
(&["coffeescript"], &["*.coffee"]),
|
||||||
("config", &["*.cfg", "*.conf", "*.config", "*.ini"]),
|
(&["config"], &["*.cfg", "*.conf", "*.config", "*.ini"]),
|
||||||
("coq", &["*.v"]),
|
(&["coq"], &["*.v"]),
|
||||||
("cpp", &[
|
(&["cpp"], &[
|
||||||
"*.[ChH]", "*.cc", "*.[ch]pp", "*.[ch]xx", "*.hh", "*.inl",
|
"*.[ChH]", "*.cc", "*.[ch]pp", "*.[ch]xx", "*.hh", "*.inl",
|
||||||
"*.[ChH].in", "*.cc.in", "*.[ch]pp.in", "*.[ch]xx.in", "*.hh.in",
|
"*.[ChH].in", "*.cc.in", "*.[ch]pp.in", "*.[ch]xx.in", "*.hh.in",
|
||||||
]),
|
]),
|
||||||
("creole", &["*.creole"]),
|
(&["creole"], &["*.creole"]),
|
||||||
("crystal", &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
|
(&["crystal"], &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
|
||||||
("cs", &["*.cs"]),
|
(&["cs"], &["*.cs"]),
|
||||||
("csharp", &["*.cs"]),
|
(&["csharp"], &["*.cs"]),
|
||||||
("cshtml", &["*.cshtml"]),
|
(&["cshtml"], &["*.cshtml"]),
|
||||||
("css", &["*.css", "*.scss"]),
|
(&["css"], &["*.css", "*.scss"]),
|
||||||
("csv", &["*.csv"]),
|
(&["csv"], &["*.csv"]),
|
||||||
("cuda", &["*.cu", "*.cuh"]),
|
(&["cuda"], &["*.cu", "*.cuh"]),
|
||||||
("cython", &["*.pyx", "*.pxi", "*.pxd"]),
|
(&["cython"], &["*.pyx", "*.pxi", "*.pxd"]),
|
||||||
("d", &["*.d"]),
|
(&["d"], &["*.d"]),
|
||||||
("dart", &["*.dart"]),
|
(&["dart"], &["*.dart"]),
|
||||||
("devicetree", &["*.dts", "*.dtsi"]),
|
(&["devicetree"], &["*.dts", "*.dtsi"]),
|
||||||
("dhall", &["*.dhall"]),
|
(&["dhall"], &["*.dhall"]),
|
||||||
("diff", &["*.patch", "*.diff"]),
|
(&["diff"], &["*.patch", "*.diff"]),
|
||||||
("dita", &["*.dita", "*.ditamap", "*.ditaval"]),
|
(&["dita"], &["*.dita", "*.ditamap", "*.ditaval"]),
|
||||||
("docker", &["*Dockerfile*"]),
|
(&["docker"], &["*Dockerfile*"]),
|
||||||
("dockercompose", &["docker-compose.yml", "docker-compose.*.yml"]),
|
(&["dockercompose"], &["docker-compose.yml", "docker-compose.*.yml"]),
|
||||||
("dts", &["*.dts", "*.dtsi"]),
|
(&["dts"], &["*.dts", "*.dtsi"]),
|
||||||
("dvc", &["Dvcfile", "*.dvc"]),
|
(&["dvc"], &["Dvcfile", "*.dvc"]),
|
||||||
("ebuild", &["*.ebuild", "*.eclass"]),
|
(&["ebuild"], &["*.ebuild", "*.eclass"]),
|
||||||
("edn", &["*.edn"]),
|
(&["edn"], &["*.edn"]),
|
||||||
("elisp", &["*.el"]),
|
(&["elisp"], &["*.el"]),
|
||||||
("elixir", &["*.ex", "*.eex", "*.exs", "*.heex", "*.leex", "*.livemd"]),
|
(&["elixir"], &["*.ex", "*.eex", "*.exs", "*.heex", "*.leex", "*.livemd"]),
|
||||||
("elm", &["*.elm"]),
|
(&["elm"], &["*.elm"]),
|
||||||
("erb", &["*.erb"]),
|
(&["erb"], &["*.erb"]),
|
||||||
("erlang", &["*.erl", "*.hrl"]),
|
(&["erlang"], &["*.erl", "*.hrl"]),
|
||||||
("fennel", &["*.fnl"]),
|
(&["fennel"], &["*.fnl"]),
|
||||||
("fidl", &["*.fidl"]),
|
(&["fidl"], &["*.fidl"]),
|
||||||
("fish", &["*.fish"]),
|
(&["fish"], &["*.fish"]),
|
||||||
("flatbuffers", &["*.fbs"]),
|
(&["flatbuffers"], &["*.fbs"]),
|
||||||
("fortran", &[
|
(&["fortran"], &[
|
||||||
"*.f", "*.F", "*.f77", "*.F77", "*.pfo",
|
"*.f", "*.F", "*.f77", "*.F77", "*.pfo",
|
||||||
"*.f90", "*.F90", "*.f95", "*.F95",
|
"*.f90", "*.F90", "*.f95", "*.F95",
|
||||||
]),
|
]),
|
||||||
("fsharp", &["*.fs", "*.fsx", "*.fsi"]),
|
(&["fsharp"], &["*.fs", "*.fsx", "*.fsi"]),
|
||||||
("fut", &["*.fut"]),
|
(&["fut"], &["*.fut"]),
|
||||||
("gap", &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
|
(&["gap"], &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
|
||||||
("gn", &["*.gn", "*.gni"]),
|
(&["gn"], &["*.gn", "*.gni"]),
|
||||||
("go", &["*.go"]),
|
(&["go"], &["*.go"]),
|
||||||
("gprbuild", &["*.gpr"]),
|
(&["gprbuild"], &["*.gpr"]),
|
||||||
("gradle", &["*.gradle"]),
|
(&["gradle"], &["*.gradle"]),
|
||||||
("graphql", &["*.graphql", "*.graphqls"]),
|
(&["graphql"], &["*.graphql", "*.graphqls"]),
|
||||||
("groovy", &["*.groovy", "*.gradle"]),
|
(&["groovy"], &["*.groovy", "*.gradle"]),
|
||||||
("gzip", &["*.gz", "*.tgz"]),
|
(&["gzip"], &["*.gz", "*.tgz"]),
|
||||||
("h", &["*.h", "*.hh", "*.hpp"]),
|
(&["h"], &["*.h", "*.hh", "*.hpp"]),
|
||||||
("haml", &["*.haml"]),
|
(&["haml"], &["*.haml"]),
|
||||||
("hare", &["*.ha"]),
|
(&["hare"], &["*.ha"]),
|
||||||
("haskell", &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
|
(&["haskell"], &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
|
||||||
("hbs", &["*.hbs"]),
|
(&["hbs"], &["*.hbs"]),
|
||||||
("hs", &["*.hs", "*.lhs"]),
|
(&["hs"], &["*.hs", "*.lhs"]),
|
||||||
("html", &["*.htm", "*.html", "*.ejs"]),
|
(&["html"], &["*.htm", "*.html", "*.ejs"]),
|
||||||
("hy", &["*.hy"]),
|
(&["hy"], &["*.hy"]),
|
||||||
("idris", &["*.idr", "*.lidr"]),
|
(&["idris"], &["*.idr", "*.lidr"]),
|
||||||
("janet", &["*.janet"]),
|
(&["janet"], &["*.janet"]),
|
||||||
("java", &["*.java", "*.jsp", "*.jspx", "*.properties"]),
|
(&["java"], &["*.java", "*.jsp", "*.jspx", "*.properties"]),
|
||||||
("jinja", &["*.j2", "*.jinja", "*.jinja2"]),
|
(&["jinja"], &["*.j2", "*.jinja", "*.jinja2"]),
|
||||||
("jl", &["*.jl"]),
|
(&["jl"], &["*.jl"]),
|
||||||
("js", &["*.js", "*.jsx", "*.vue", "*.cjs", "*.mjs"]),
|
(&["js"], &["*.js", "*.jsx", "*.vue", "*.cjs", "*.mjs"]),
|
||||||
("json", &["*.json", "composer.lock"]),
|
(&["json"], &["*.json", "composer.lock"]),
|
||||||
("jsonl", &["*.jsonl"]),
|
(&["jsonl"], &["*.jsonl"]),
|
||||||
("julia", &["*.jl"]),
|
(&["julia"], &["*.jl"]),
|
||||||
("jupyter", &["*.ipynb", "*.jpynb"]),
|
(&["jupyter"], &["*.ipynb", "*.jpynb"]),
|
||||||
("k", &["*.k"]),
|
(&["k"], &["*.k"]),
|
||||||
("kotlin", &["*.kt", "*.kts"]),
|
(&["kotlin"], &["*.kt", "*.kts"]),
|
||||||
("less", &["*.less"]),
|
(&["less"], &["*.less"]),
|
||||||
("license", &[
|
(&["license"], &[
|
||||||
// General
|
// General
|
||||||
"COPYING", "COPYING[.-]*",
|
"COPYING", "COPYING[.-]*",
|
||||||
"COPYRIGHT", "COPYRIGHT[.-]*",
|
"COPYRIGHT", "COPYRIGHT[.-]*",
|
||||||
@ -140,23 +140,23 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
|||||||
"MPL-*[0-9]*",
|
"MPL-*[0-9]*",
|
||||||
"OFL-*[0-9]*",
|
"OFL-*[0-9]*",
|
||||||
]),
|
]),
|
||||||
("lilypond", &["*.ly", "*.ily"]),
|
(&["lilypond"], &["*.ly", "*.ily"]),
|
||||||
("lisp", &["*.el", "*.jl", "*.lisp", "*.lsp", "*.sc", "*.scm"]),
|
(&["lisp"], &["*.el", "*.jl", "*.lisp", "*.lsp", "*.sc", "*.scm"]),
|
||||||
("lock", &["*.lock", "package-lock.json"]),
|
(&["lock"], &["*.lock", "package-lock.json"]),
|
||||||
("log", &["*.log"]),
|
(&["log"], &["*.log"]),
|
||||||
("lua", &["*.lua"]),
|
(&["lua"], &["*.lua"]),
|
||||||
("lz4", &["*.lz4"]),
|
(&["lz4"], &["*.lz4"]),
|
||||||
("lzma", &["*.lzma"]),
|
(&["lzma"], &["*.lzma"]),
|
||||||
("m4", &["*.ac", "*.m4"]),
|
(&["m4"], &["*.ac", "*.m4"]),
|
||||||
("make", &[
|
(&["make"], &[
|
||||||
"[Gg][Nn][Uu]makefile", "[Mm]akefile",
|
"[Gg][Nn][Uu]makefile", "[Mm]akefile",
|
||||||
"[Gg][Nn][Uu]makefile.am", "[Mm]akefile.am",
|
"[Gg][Nn][Uu]makefile.am", "[Mm]akefile.am",
|
||||||
"[Gg][Nn][Uu]makefile.in", "[Mm]akefile.in",
|
"[Gg][Nn][Uu]makefile.in", "[Mm]akefile.in",
|
||||||
"*.mk", "*.mak"
|
"*.mk", "*.mak"
|
||||||
]),
|
]),
|
||||||
("mako", &["*.mako", "*.mao"]),
|
(&["mako"], &["*.mako", "*.mao"]),
|
||||||
("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
|
(&["man"], &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
|
||||||
("markdown", &[
|
(&["markdown", "md"], &[
|
||||||
"*.markdown",
|
"*.markdown",
|
||||||
"*.md",
|
"*.md",
|
||||||
"*.mdown",
|
"*.mdown",
|
||||||
@ -165,75 +165,66 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
|||||||
"*.mkdn",
|
"*.mkdn",
|
||||||
"*.mdx",
|
"*.mdx",
|
||||||
]),
|
]),
|
||||||
("matlab", &["*.m"]),
|
(&["matlab"], &["*.m"]),
|
||||||
("md", &[
|
(&["meson"], &["meson.build", "meson_options.txt"]),
|
||||||
"*.markdown",
|
(&["minified"], &["*.min.html", "*.min.css", "*.min.js"]),
|
||||||
"*.md",
|
(&["mint"], &["*.mint"]),
|
||||||
"*.mdown",
|
(&["mk"], &["mkfile"]),
|
||||||
"*.mdwn",
|
(&["ml"], &["*.ml"]),
|
||||||
"*.mkd",
|
(&["motoko"], &["*.mo"]),
|
||||||
"*.mkdn",
|
(&["msbuild"], &[
|
||||||
"*.mdx",
|
|
||||||
]),
|
|
||||||
("meson", &["meson.build", "meson_options.txt"]),
|
|
||||||
("minified", &["*.min.html", "*.min.css", "*.min.js"]),
|
|
||||||
("mint", &["*.mint"]),
|
|
||||||
("mk", &["mkfile"]),
|
|
||||||
("ml", &["*.ml"]),
|
|
||||||
("motoko", &["*.mo"]),
|
|
||||||
("msbuild", &[
|
|
||||||
"*.csproj", "*.fsproj", "*.vcxproj", "*.proj", "*.props", "*.targets",
|
"*.csproj", "*.fsproj", "*.vcxproj", "*.proj", "*.props", "*.targets",
|
||||||
"*.sln",
|
"*.sln",
|
||||||
]),
|
]),
|
||||||
("nim", &["*.nim", "*.nimf", "*.nimble", "*.nims"]),
|
(&["nim"], &["*.nim", "*.nimf", "*.nimble", "*.nims"]),
|
||||||
("nix", &["*.nix"]),
|
(&["nix"], &["*.nix"]),
|
||||||
("objc", &["*.h", "*.m"]),
|
(&["objc"], &["*.h", "*.m"]),
|
||||||
("objcpp", &["*.h", "*.mm"]),
|
(&["objcpp"], &["*.h", "*.mm"]),
|
||||||
("ocaml", &["*.ml", "*.mli", "*.mll", "*.mly"]),
|
(&["ocaml"], &["*.ml", "*.mli", "*.mll", "*.mly"]),
|
||||||
("org", &["*.org", "*.org_archive"]),
|
(&["org"], &["*.org", "*.org_archive"]),
|
||||||
("pants", &["BUILD"]),
|
(&["pants"], &["BUILD"]),
|
||||||
("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
|
(&["pascal"], &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
|
||||||
("pdf", &["*.pdf"]),
|
(&["pdf"], &["*.pdf"]),
|
||||||
("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
|
(&["perl"], &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
|
||||||
("php", &[
|
(&["php"], &[
|
||||||
// note that PHP 6 doesn't exist
|
// note that PHP 6 doesn't exist
|
||||||
// See: https://wiki.php.net/rfc/php6
|
// See: https://wiki.php.net/rfc/php6
|
||||||
"*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
|
"*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
|
||||||
"*.pht", "*.phtml"
|
"*.pht", "*.phtml"
|
||||||
]),
|
]),
|
||||||
("po", &["*.po"]),
|
(&["po"], &["*.po"]),
|
||||||
("pod", &["*.pod"]),
|
(&["pod"], &["*.pod"]),
|
||||||
("postscript", &["*.eps", "*.ps"]),
|
(&["postscript"], &["*.eps", "*.ps"]),
|
||||||
("protobuf", &["*.proto"]),
|
(&["protobuf"], &["*.proto"]),
|
||||||
("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
|
(&["ps"], &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
|
||||||
("puppet", &["*.epp", "*.erb", "*.pp", "*.rb"]),
|
(&["puppet"], &["*.epp", "*.erb", "*.pp", "*.rb"]),
|
||||||
("purs", &["*.purs"]),
|
(&["purs"], &["*.purs"]),
|
||||||
("py", &["*.py", "*.pyi"]),
|
(&["py", "python"], &["*.py", "*.pyi"]),
|
||||||
("qmake", &["*.pro", "*.pri", "*.prf"]),
|
(&["qmake"], &["*.pro", "*.pri", "*.prf"]),
|
||||||
("qml", &["*.qml"]),
|
(&["qml"], &["*.qml"]),
|
||||||
("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
|
(&["r"], &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
|
||||||
("racket", &["*.rkt"]),
|
(&["racket"], &["*.rkt"]),
|
||||||
("raku", &[
|
(&["raku"], &[
|
||||||
"*.raku", "*.rakumod", "*.rakudoc", "*.rakutest",
|
"*.raku", "*.rakumod", "*.rakudoc", "*.rakutest",
|
||||||
"*.p6", "*.pl6", "*.pm6"
|
"*.p6", "*.pl6", "*.pm6"
|
||||||
]),
|
]),
|
||||||
("rdoc", &["*.rdoc"]),
|
(&["rdoc"], &["*.rdoc"]),
|
||||||
("readme", &["README*", "*README"]),
|
(&["readme"], &["README*", "*README"]),
|
||||||
("reasonml", &["*.re", "*.rei"]),
|
(&["reasonml"], &["*.re", "*.rei"]),
|
||||||
("red", &["*.r", "*.red", "*.reds"]),
|
(&["red"], &["*.r", "*.red", "*.reds"]),
|
||||||
("rescript", &["*.res", "*.resi"]),
|
(&["rescript"], &["*.res", "*.resi"]),
|
||||||
("robot", &["*.robot"]),
|
(&["robot"], &["*.robot"]),
|
||||||
("rst", &["*.rst"]),
|
(&["rst"], &["*.rst"]),
|
||||||
("ruby", &[
|
(&["ruby"], &[
|
||||||
// Idiomatic files
|
// Idiomatic files
|
||||||
"config.ru", "Gemfile", ".irbrc", "Rakefile",
|
"config.ru", "Gemfile", ".irbrc", "Rakefile",
|
||||||
// Extensions
|
// Extensions
|
||||||
"*.gemspec", "*.rb", "*.rbw"
|
"*.gemspec", "*.rb", "*.rbw"
|
||||||
]),
|
]),
|
||||||
("rust", &["*.rs"]),
|
(&["rust"], &["*.rs"]),
|
||||||
("sass", &["*.sass", "*.scss"]),
|
(&["sass"], &["*.sass", "*.scss"]),
|
||||||
("scala", &["*.scala", "*.sbt"]),
|
(&["scala"], &["*.scala", "*.sbt"]),
|
||||||
("sh", &[
|
(&["sh"], &[
|
||||||
// Portable/misc. init files
|
// Portable/misc. init files
|
||||||
".login", ".logout", ".profile", "profile",
|
".login", ".logout", ".profile", "profile",
|
||||||
// bash-specific init files
|
// bash-specific init files
|
||||||
@ -256,67 +247,66 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
|||||||
// Extensions
|
// Extensions
|
||||||
"*.bash", "*.csh", "*.ksh", "*.sh", "*.tcsh", "*.zsh",
|
"*.bash", "*.csh", "*.ksh", "*.sh", "*.tcsh", "*.zsh",
|
||||||
]),
|
]),
|
||||||
("slim", &["*.skim", "*.slim", "*.slime"]),
|
(&["slim"], &["*.skim", "*.slim", "*.slime"]),
|
||||||
("smarty", &["*.tpl"]),
|
(&["smarty"], &["*.tpl"]),
|
||||||
("sml", &["*.sml", "*.sig"]),
|
(&["sml"], &["*.sml", "*.sig"]),
|
||||||
("solidity", &["*.sol"]),
|
(&["solidity"], &["*.sol"]),
|
||||||
("soy", &["*.soy"]),
|
(&["soy"], &["*.soy"]),
|
||||||
("spark", &["*.spark"]),
|
(&["spark"], &["*.spark"]),
|
||||||
("spec", &["*.spec"]),
|
(&["spec"], &["*.spec"]),
|
||||||
("sql", &["*.sql", "*.psql"]),
|
(&["sql"], &["*.sql", "*.psql"]),
|
||||||
("stylus", &["*.styl"]),
|
(&["stylus"], &["*.styl"]),
|
||||||
("sv", &["*.v", "*.vg", "*.sv", "*.svh", "*.h"]),
|
(&["sv"], &["*.v", "*.vg", "*.sv", "*.svh", "*.h"]),
|
||||||
("svg", &["*.svg"]),
|
(&["svg"], &["*.svg"]),
|
||||||
("swift", &["*.swift"]),
|
(&["swift"], &["*.swift"]),
|
||||||
("swig", &["*.def", "*.i"]),
|
(&["swig"], &["*.def", "*.i"]),
|
||||||
("systemd", &[
|
(&["systemd"], &[
|
||||||
"*.automount", "*.conf", "*.device", "*.link", "*.mount", "*.path",
|
"*.automount", "*.conf", "*.device", "*.link", "*.mount", "*.path",
|
||||||
"*.scope", "*.service", "*.slice", "*.socket", "*.swap", "*.target",
|
"*.scope", "*.service", "*.slice", "*.socket", "*.swap", "*.target",
|
||||||
"*.timer",
|
"*.timer",
|
||||||
]),
|
]),
|
||||||
("taskpaper", &["*.taskpaper"]),
|
(&["taskpaper"], &["*.taskpaper"]),
|
||||||
("tcl", &["*.tcl"]),
|
(&["tcl"], &["*.tcl"]),
|
||||||
("tex", &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
|
(&["tex"], &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
|
||||||
("texinfo", &["*.texi"]),
|
(&["texinfo"], &["*.texi"]),
|
||||||
("textile", &["*.textile"]),
|
(&["textile"], &["*.textile"]),
|
||||||
("tf", &[
|
(&["tf"], &[
|
||||||
"*.tf", "*.auto.tfvars", "terraform.tfvars", "*.tf.json",
|
"*.tf", "*.auto.tfvars", "terraform.tfvars", "*.tf.json",
|
||||||
"*.auto.tfvars.json", "terraform.tfvars.json", "*.terraformrc",
|
"*.auto.tfvars.json", "terraform.tfvars.json", "*.terraformrc",
|
||||||
"terraform.rc", "*.tfrc", "*.terraform.lock.hcl",
|
"terraform.rc", "*.tfrc", "*.terraform.lock.hcl",
|
||||||
]),
|
]),
|
||||||
("thrift", &["*.thrift"]),
|
(&["thrift"], &["*.thrift"]),
|
||||||
("toml", &["*.toml", "Cargo.lock"]),
|
(&["toml"], &["*.toml", "Cargo.lock"]),
|
||||||
("ts", &["*.ts", "*.tsx", "*.cts", "*.mts"]),
|
(&["ts", "typescript"], &["*.ts", "*.tsx", "*.cts", "*.mts"]),
|
||||||
("twig", &["*.twig"]),
|
(&["twig"], &["*.twig"]),
|
||||||
("txt", &["*.txt"]),
|
(&["txt"], &["*.txt"]),
|
||||||
("typescript", &["*.ts", "*.tsx", "*.cts", "*.mts"]),
|
(&["typoscript"], &["*.typoscript", "*.ts"]),
|
||||||
("typoscript", &["*.typoscript", "*.ts"]),
|
(&["usd"], &["*.usd", "*.usda", "*.usdc"]),
|
||||||
("usd", &["*.usd", "*.usda", "*.usdc"]),
|
(&["v"], &["*.v"]),
|
||||||
("v", &["*.v"]),
|
(&["vala"], &["*.vala"]),
|
||||||
("vala", &["*.vala"]),
|
(&["vb"], &["*.vb"]),
|
||||||
("vb", &["*.vb"]),
|
(&["vcl"], &["*.vcl"]),
|
||||||
("vcl", &["*.vcl"]),
|
(&["verilog"], &["*.v", "*.vh", "*.sv", "*.svh"]),
|
||||||
("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]),
|
(&["vhdl"], &["*.vhd", "*.vhdl"]),
|
||||||
("vhdl", &["*.vhd", "*.vhdl"]),
|
(&["vim"], &[
|
||||||
("vim", &[
|
|
||||||
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
|
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
|
||||||
]),
|
]),
|
||||||
("vimscript", &[
|
(&["vimscript"], &[
|
||||||
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
|
"*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
|
||||||
]),
|
]),
|
||||||
("webidl", &["*.idl", "*.webidl", "*.widl"]),
|
(&["webidl"], &["*.idl", "*.webidl", "*.widl"]),
|
||||||
("wiki", &["*.mediawiki", "*.wiki"]),
|
(&["wiki"], &["*.mediawiki", "*.wiki"]),
|
||||||
("xml", &[
|
(&["xml"], &[
|
||||||
"*.xml", "*.xml.dist", "*.dtd", "*.xsl", "*.xslt", "*.xsd", "*.xjb",
|
"*.xml", "*.xml.dist", "*.dtd", "*.xsl", "*.xslt", "*.xsd", "*.xjb",
|
||||||
"*.rng", "*.sch", "*.xhtml",
|
"*.rng", "*.sch", "*.xhtml",
|
||||||
]),
|
]),
|
||||||
("xz", &["*.xz", "*.txz"]),
|
(&["xz"], &["*.xz", "*.txz"]),
|
||||||
("yacc", &["*.y"]),
|
(&["yacc"], &["*.y"]),
|
||||||
("yaml", &["*.yaml", "*.yml"]),
|
(&["yaml"], &["*.yaml", "*.yml"]),
|
||||||
("yang", &["*.yang"]),
|
(&["yang"], &["*.yang"]),
|
||||||
("z", &["*.Z"]),
|
(&["z"], &["*.Z"]),
|
||||||
("zig", &["*.zig"]),
|
(&["zig"], &["*.zig"]),
|
||||||
("zsh", &[
|
(&["zsh"], &[
|
||||||
".zshenv", "zshenv",
|
".zshenv", "zshenv",
|
||||||
".zlogin", "zlogin",
|
".zlogin", "zlogin",
|
||||||
".zlogout", "zlogout",
|
".zlogout", "zlogout",
|
||||||
@ -324,7 +314,7 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
|
|||||||
".zshrc", "zshrc",
|
".zshrc", "zshrc",
|
||||||
"*.zsh",
|
"*.zsh",
|
||||||
]),
|
]),
|
||||||
("zstd", &["*.zst", "*.zstd"]),
|
(&["zstd"], &["*.zst", "*.zstd"]),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -333,10 +323,8 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn default_types_are_sorted() {
|
fn default_types_are_sorted() {
|
||||||
let mut names = DEFAULT_TYPES.iter().map(|(name, _exts)| name);
|
let mut names = DEFAULT_TYPES.iter().map(|(aliases, _)| aliases[0]);
|
||||||
|
|
||||||
let Some(mut previous_name) = names.next() else { return; };
|
let Some(mut previous_name) = names.next() else { return; };
|
||||||
|
|
||||||
for name in names {
|
for name in names {
|
||||||
assert!(
|
assert!(
|
||||||
name > previous_name,
|
name > previous_name,
|
||||||
@ -344,7 +332,6 @@ mod tests {
|
|||||||
name,
|
name,
|
||||||
previous_name
|
previous_name
|
||||||
);
|
);
|
||||||
|
|
||||||
previous_name = name;
|
previous_name = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,11 +488,13 @@ impl TypesBuilder {
|
|||||||
/// Add a set of default file type definitions.
|
/// Add a set of default file type definitions.
|
||||||
pub fn add_defaults(&mut self) -> &mut TypesBuilder {
|
pub fn add_defaults(&mut self) -> &mut TypesBuilder {
|
||||||
static MSG: &'static str = "adding a default type should never fail";
|
static MSG: &'static str = "adding a default type should never fail";
|
||||||
for &(name, exts) in DEFAULT_TYPES {
|
for &(names, exts) in DEFAULT_TYPES {
|
||||||
|
for name in names {
|
||||||
for ext in exts {
|
for ext in exts {
|
||||||
self.add(name, ext).expect(MSG);
|
self.add(name, ext).expect(MSG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,6 +539,8 @@ mod tests {
|
|||||||
"html:*.htm",
|
"html:*.htm",
|
||||||
"rust:*.rs",
|
"rust:*.rs",
|
||||||
"js:*.js",
|
"js:*.js",
|
||||||
|
"py:*.py",
|
||||||
|
"python:*.py",
|
||||||
"foo:*.{rs,foo}",
|
"foo:*.{rs,foo}",
|
||||||
"combo:include:html,rust",
|
"combo:include:html,rust",
|
||||||
]
|
]
|
||||||
@ -551,6 +555,8 @@ mod tests {
|
|||||||
matched!(match7, types(), vec!["foo"], vec!["rust"], "main.foo");
|
matched!(match7, types(), vec!["foo"], vec!["rust"], "main.foo");
|
||||||
matched!(match8, types(), vec!["combo"], vec![], "index.html");
|
matched!(match8, types(), vec!["combo"], vec![], "index.html");
|
||||||
matched!(match9, types(), vec!["combo"], vec![], "lib.rs");
|
matched!(match9, types(), vec!["combo"], vec![], "lib.rs");
|
||||||
|
matched!(match10, types(), vec!["py"], vec![], "main.py");
|
||||||
|
matched!(match11, types(), vec!["python"], vec![], "main.py");
|
||||||
|
|
||||||
matched!(not, matchnot1, types(), vec!["rust"], vec![], "index.html");
|
matched!(not, matchnot1, types(), vec!["rust"], vec![], "index.html");
|
||||||
matched!(not, matchnot2, types(), vec![], vec!["rust"], "main.rs");
|
matched!(not, matchnot2, types(), vec![], vec!["rust"], "main.rs");
|
||||||
@ -558,6 +564,8 @@ mod tests {
|
|||||||
matched!(not, matchnot4, types(), vec!["rust"], vec!["foo"], "main.rs");
|
matched!(not, matchnot4, types(), vec!["rust"], vec!["foo"], "main.rs");
|
||||||
matched!(not, matchnot5, types(), vec!["rust"], vec!["foo"], "main.foo");
|
matched!(not, matchnot5, types(), vec!["rust"], vec!["foo"], "main.foo");
|
||||||
matched!(not, matchnot6, types(), vec!["combo"], vec![], "leftpad.js");
|
matched!(not, matchnot6, types(), vec!["combo"], vec![], "leftpad.js");
|
||||||
|
matched!(not, matchnot7, types(), vec!["py"], vec![], "index.html");
|
||||||
|
matched!(not, matchnot8, types(), vec!["python"], vec![], "doc.md");
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_invalid_defs() {
|
fn test_invalid_defs() {
|
||||||
@ -569,7 +577,7 @@ mod tests {
|
|||||||
let original_defs = btypes.definitions();
|
let original_defs = btypes.definitions();
|
||||||
let bad_defs = vec![
|
let bad_defs = vec![
|
||||||
// Reference to type that does not exist
|
// Reference to type that does not exist
|
||||||
"combo:include:html,python",
|
"combo:include:html,qwerty",
|
||||||
// Bad format
|
// Bad format
|
||||||
"combo:foobar:html,rust",
|
"combo:foobar:html,rust",
|
||||||
"",
|
"",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user