1 | /// This list represents the default file types that ripgrep ships with. In |
2 | /// general, any file format is fair game, although it should generally be |
3 | /// limited to reasonably popular open formats. For other cases, you can add |
4 | /// types to each invocation of ripgrep with the '--type-add' flag. |
5 | /// |
6 | /// If you would like to add or improve this list, please file a PR: |
7 | /// <https://github.com/BurntSushi/ripgrep>. |
8 | /// |
9 | /// Please try to keep this list sorted lexicographically and wrapped to 79 |
10 | /// columns (inclusive). |
11 | #[rustfmt::skip] |
12 | pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[ |
13 | ("agda" , &["*.agda" , "*.lagda" ]), |
14 | ("aidl" , &["*.aidl" ]), |
15 | ("amake" , &["*.mk" , "*.bp" ]), |
16 | ("asciidoc" , &["*.adoc" , "*.asc" , "*.asciidoc" ]), |
17 | ("asm" , &["*.asm" , "*.s" , "*.S" ]), |
18 | ("asp" , &[ |
19 | "*.aspx" , "*.aspx.cs" , "*.aspx.vb" , "*.ascx" , "*.ascx.cs" , |
20 | "*.ascx.vb" , "*.asp" |
21 | ]), |
22 | ("ats" , &["*.ats" , "*.dats" , "*.sats" , "*.hats" ]), |
23 | ("avro" , &["*.avdl" , "*.avpr" , "*.avsc" ]), |
24 | ("awk" , &["*.awk" ]), |
25 | ("bazel" , &[ |
26 | "*.bazel" , "*.bzl" , "*.BUILD" , "*.bazelrc" , "BUILD" , "MODULE.bazel" , |
27 | "WORKSPACE" , "WORKSPACE.bazel" , |
28 | ]), |
29 | ("bitbake" , &["*.bb" , "*.bbappend" , "*.bbclass" , "*.conf" , "*.inc" ]), |
30 | ("brotli" , &["*.br" ]), |
31 | ("buildstream" , &["*.bst" ]), |
32 | ("bzip2" , &["*.bz2" , "*.tbz2" ]), |
33 | ("c" , &["*.[chH]" , "*.[chH].in" , "*.cats" ]), |
34 | ("cabal" , &["*.cabal" ]), |
35 | ("candid" , &["*.did" ]), |
36 | ("carp" , &["*.carp" ]), |
37 | ("cbor" , &["*.cbor" ]), |
38 | ("ceylon" , &["*.ceylon" ]), |
39 | ("clojure" , &["*.clj" , "*.cljc" , "*.cljs" , "*.cljx" ]), |
40 | ("cmake" , &["*.cmake" , "CMakeLists.txt" ]), |
41 | ("coffeescript" , &["*.coffee" ]), |
42 | ("config" , &["*.cfg" , "*.conf" , "*.config" , "*.ini" ]), |
43 | ("coq" , &["*.v" ]), |
44 | ("cpp" , &[ |
45 | "*.[ChH]" , "*.cc" , "*.[ch]pp" , "*.[ch]xx" , "*.hh" , "*.inl" , |
46 | "*.[ChH].in" , "*.cc.in" , "*.[ch]pp.in" , "*.[ch]xx.in" , "*.hh.in" , |
47 | ]), |
48 | ("creole" , &["*.creole" ]), |
49 | ("crystal" , &["Projectfile" , "*.cr" , "*.ecr" , "shard.yml" ]), |
50 | ("cs" , &["*.cs" ]), |
51 | ("csharp" , &["*.cs" ]), |
52 | ("cshtml" , &["*.cshtml" ]), |
53 | ("css" , &["*.css" , "*.scss" ]), |
54 | ("csv" , &["*.csv" ]), |
55 | ("cuda" , &["*.cu" , "*.cuh" ]), |
56 | ("cython" , &["*.pyx" , "*.pxi" , "*.pxd" ]), |
57 | ("d" , &["*.d" ]), |
58 | ("dart" , &["*.dart" ]), |
59 | ("devicetree" , &["*.dts" , "*.dtsi" ]), |
60 | ("dhall" , &["*.dhall" ]), |
61 | ("diff" , &["*.patch" , "*.diff" ]), |
62 | ("docker" , &["*Dockerfile*" ]), |
63 | ("dts" , &["*.dts" , "*.dtsi" ]), |
64 | ("dvc" , &["Dvcfile" , "*.dvc" ]), |
65 | ("ebuild" , &["*.ebuild" ]), |
66 | ("edn" , &["*.edn" ]), |
67 | ("elisp" , &["*.el" ]), |
68 | ("elixir" , &["*.ex" , "*.eex" , "*.exs" ]), |
69 | ("elm" , &["*.elm" ]), |
70 | ("erb" , &["*.erb" ]), |
71 | ("erlang" , &["*.erl" , "*.hrl" ]), |
72 | ("fennel" , &["*.fnl" ]), |
73 | ("fidl" , &["*.fidl" ]), |
74 | ("fish" , &["*.fish" ]), |
75 | ("flatbuffers" , &["*.fbs" ]), |
76 | ("fortran" , &[ |
77 | "*.f" , "*.F" , "*.f77" , "*.F77" , "*.pfo" , |
78 | "*.f90" , "*.F90" , "*.f95" , "*.F95" , |
79 | ]), |
80 | ("fsharp" , &["*.fs" , "*.fsx" , "*.fsi" ]), |
81 | ("fut" , &["*.fut" ]), |
82 | ("gap" , &["*.g" , "*.gap" , "*.gi" , "*.gd" , "*.tst" ]), |
83 | ("gn" , &["*.gn" , "*.gni" ]), |
84 | ("go" , &["*.go" ]), |
85 | ("gradle" , &["*.gradle" ]), |
86 | ("groovy" , &["*.groovy" , "*.gradle" ]), |
87 | ("gzip" , &["*.gz" , "*.tgz" ]), |
88 | ("h" , &["*.h" , "*.hh" , "*.hpp" ]), |
89 | ("haml" , &["*.haml" ]), |
90 | ("hare" , &["*.ha" ]), |
91 | ("haskell" , &["*.hs" , "*.lhs" , "*.cpphs" , "*.c2hs" , "*.hsc" ]), |
92 | ("hbs" , &["*.hbs" ]), |
93 | ("hs" , &["*.hs" , "*.lhs" ]), |
94 | ("html" , &["*.htm" , "*.html" , "*.ejs" ]), |
95 | ("hy" , &["*.hy" ]), |
96 | ("idris" , &["*.idr" , "*.lidr" ]), |
97 | ("janet" , &["*.janet" ]), |
98 | ("java" , &["*.java" , "*.jsp" , "*.jspx" , "*.properties" ]), |
99 | ("jinja" , &["*.j2" , "*.jinja" , "*.jinja2" ]), |
100 | ("jl" , &["*.jl" ]), |
101 | ("js" , &["*.js" , "*.jsx" , "*.vue" , "*.cjs" , "*.mjs" ]), |
102 | ("json" , &["*.json" , "composer.lock" ]), |
103 | ("jsonl" , &["*.jsonl" ]), |
104 | ("julia" , &["*.jl" ]), |
105 | ("jupyter" , &["*.ipynb" , "*.jpynb" ]), |
106 | ("k" , &["*.k" ]), |
107 | ("kotlin" , &["*.kt" , "*.kts" ]), |
108 | ("less" , &["*.less" ]), |
109 | ("license" , &[ |
110 | // General |
111 | "COPYING" , "COPYING[.-]*" , |
112 | "COPYRIGHT" , "COPYRIGHT[.-]*" , |
113 | "EULA" , "EULA[.-]*" , |
114 | "licen[cs]e" , "licen[cs]e.*" , |
115 | "LICEN[CS]E" , "LICEN[CS]E[.-]*" , "*[.-]LICEN[CS]E*" , |
116 | "NOTICE" , "NOTICE[.-]*" , |
117 | "PATENTS" , "PATENTS[.-]*" , |
118 | "UNLICEN[CS]E" , "UNLICEN[CS]E[.-]*" , |
119 | // GPL (gpl.txt, etc.) |
120 | "agpl[.-]*" , |
121 | "gpl[.-]*" , |
122 | "lgpl[.-]*" , |
123 | // Other license-specific (APACHE-2.0.txt, etc.) |
124 | "AGPL-*[0-9]*" , |
125 | "APACHE-*[0-9]*" , |
126 | "BSD-*[0-9]*" , |
127 | "CC-BY-*" , |
128 | "GFDL-*[0-9]*" , |
129 | "GNU-*[0-9]*" , |
130 | "GPL-*[0-9]*" , |
131 | "LGPL-*[0-9]*" , |
132 | "MIT-*[0-9]*" , |
133 | "MPL-*[0-9]*" , |
134 | "OFL-*[0-9]*" , |
135 | ]), |
136 | ("lilypond" , &["*.ly" , "*.ily" ]), |
137 | ("lisp" , &["*.el" , "*.jl" , "*.lisp" , "*.lsp" , "*.sc" , "*.scm" ]), |
138 | ("lock" , &["*.lock" , "package-lock.json" ]), |
139 | ("log" , &["*.log" ]), |
140 | ("lua" , &["*.lua" ]), |
141 | ("lz4" , &["*.lz4" ]), |
142 | ("lzma" , &["*.lzma" ]), |
143 | ("m4" , &["*.ac" , "*.m4" ]), |
144 | ("make" , &[ |
145 | "[Gg][Nn][Uu]makefile" , "[Mm]akefile" , |
146 | "[Gg][Nn][Uu]makefile.am" , "[Mm]akefile.am" , |
147 | "[Gg][Nn][Uu]makefile.in" , "[Mm]akefile.in" , |
148 | "*.mk" , "*.mak" |
149 | ]), |
150 | ("mako" , &["*.mako" , "*.mao" ]), |
151 | ("man" , &["*.[0-9lnpx]" , "*.[0-9][cEFMmpSx]" ]), |
152 | ("markdown" , &["*.markdown" , "*.md" , "*.mdown" , "*.mkd" , "*.mkdn" ]), |
153 | ("matlab" , &["*.m" ]), |
154 | ("md" , &["*.markdown" , "*.md" , "*.mdown" , "*.mkd" , "*.mkdn" ]), |
155 | ("meson" , &["meson.build" , "meson_options.txt" ]), |
156 | ("minified" , &["*.min.html" , "*.min.css" , "*.min.js" ]), |
157 | ("mint" , &["*.mint" ]), |
158 | ("mk" , &["mkfile" ]), |
159 | ("ml" , &["*.ml" ]), |
160 | ("motoko" , &["*.mo" ]), |
161 | ("msbuild" , &[ |
162 | "*.csproj" , "*.fsproj" , "*.vcxproj" , "*.proj" , "*.props" , "*.targets" , |
163 | ]), |
164 | ("nim" , &["*.nim" , "*.nimf" , "*.nimble" , "*.nims" ]), |
165 | ("nix" , &["*.nix" ]), |
166 | ("objc" , &["*.h" , "*.m" ]), |
167 | ("objcpp" , &["*.h" , "*.mm" ]), |
168 | ("ocaml" , &["*.ml" , "*.mli" , "*.mll" , "*.mly" ]), |
169 | ("org" , &["*.org" , "*.org_archive" ]), |
170 | ("pants" , &["BUILD" ]), |
171 | ("pascal" , &["*.pas" , "*.dpr" , "*.lpr" , "*.pp" , "*.inc" ]), |
172 | ("pdf" , &["*.pdf" ]), |
173 | ("perl" , &["*.perl" , "*.pl" , "*.PL" , "*.plh" , "*.plx" , "*.pm" , "*.t" ]), |
174 | ("php" , &[ |
175 | // note that PHP 6 doesn't exist |
176 | // See: https://wiki.php.net/rfc/php6 |
177 | "*.php" , "*.php3" , "*.php4" , "*.php5" , "*.php7" , "*.php8" , |
178 | "*.pht" , "*.phtml" |
179 | ]), |
180 | ("po" , &["*.po" ]), |
181 | ("pod" , &["*.pod" ]), |
182 | ("postscript" , &["*.eps" , "*.ps" ]), |
183 | ("protobuf" , &["*.proto" ]), |
184 | ("ps" , &["*.cdxml" , "*.ps1" , "*.ps1xml" , "*.psd1" , "*.psm1" ]), |
185 | ("puppet" , &["*.epp" , "*.erb" , "*.pp" , "*.rb" ]), |
186 | ("purs" , &["*.purs" ]), |
187 | ("py" , &["*.py" ]), |
188 | ("qmake" , &["*.pro" , "*.pri" , "*.prf" ]), |
189 | ("qml" , &["*.qml" ]), |
190 | ("r" , &["*.R" , "*.r" , "*.Rmd" , "*.Rnw" ]), |
191 | ("racket" , &["*.rkt" ]), |
192 | ("rdoc" , &["*.rdoc" ]), |
193 | ("readme" , &["README*" , "*README" ]), |
194 | ("reasonml" , &["*.re" , "*.rei" ]), |
195 | ("red" , &["*.r" , "*.red" , "*.reds" ]), |
196 | ("rescript" , &["*.res" , "*.resi" ]), |
197 | ("robot" , &["*.robot" ]), |
198 | ("rst" , &["*.rst" ]), |
199 | ("ruby" , &[ |
200 | // Idiomatic files |
201 | "config.ru" , "Gemfile" , ".irbrc" , "Rakefile" , |
202 | // Extensions |
203 | "*.gemspec" , "*.rb" , "*.rbw" |
204 | ]), |
205 | ("rust" , &["*.rs" ]), |
206 | ("sass" , &["*.sass" , "*.scss" ]), |
207 | ("scala" , &["*.scala" , "*.sbt" ]), |
208 | ("sh" , &[ |
209 | // Portable/misc. init files |
210 | ".login" , ".logout" , ".profile" , "profile" , |
211 | // bash-specific init files |
212 | ".bash_login" , "bash_login" , |
213 | ".bash_logout" , "bash_logout" , |
214 | ".bash_profile" , "bash_profile" , |
215 | ".bashrc" , "bashrc" , "*.bashrc" , |
216 | // csh-specific init files |
217 | ".cshrc" , "*.cshrc" , |
218 | // ksh-specific init files |
219 | ".kshrc" , "*.kshrc" , |
220 | // tcsh-specific init files |
221 | ".tcshrc" , |
222 | // zsh-specific init files |
223 | ".zshenv" , "zshenv" , |
224 | ".zlogin" , "zlogin" , |
225 | ".zlogout" , "zlogout" , |
226 | ".zprofile" , "zprofile" , |
227 | ".zshrc" , "zshrc" , |
228 | // Extensions |
229 | "*.bash" , "*.csh" , "*.ksh" , "*.sh" , "*.tcsh" , "*.zsh" , |
230 | ]), |
231 | ("slim" , &["*.skim" , "*.slim" , "*.slime" ]), |
232 | ("smarty" , &["*.tpl" ]), |
233 | ("sml" , &["*.sml" , "*.sig" ]), |
234 | ("solidity" , &["*.sol" ]), |
235 | ("soy" , &["*.soy" ]), |
236 | ("spark" , &["*.spark" ]), |
237 | ("spec" , &["*.spec" ]), |
238 | ("sql" , &["*.sql" , "*.psql" ]), |
239 | ("stylus" , &["*.styl" ]), |
240 | ("sv" , &["*.v" , "*.vg" , "*.sv" , "*.svh" , "*.h" ]), |
241 | ("svg" , &["*.svg" ]), |
242 | ("swift" , &["*.swift" ]), |
243 | ("swig" , &["*.def" , "*.i" ]), |
244 | ("systemd" , &[ |
245 | "*.automount" , "*.conf" , "*.device" , "*.link" , "*.mount" , "*.path" , |
246 | "*.scope" , "*.service" , "*.slice" , "*.socket" , "*.swap" , "*.target" , |
247 | "*.timer" , |
248 | ]), |
249 | ("taskpaper" , &["*.taskpaper" ]), |
250 | ("tcl" , &["*.tcl" ]), |
251 | ("tex" , &["*.tex" , "*.ltx" , "*.cls" , "*.sty" , "*.bib" , "*.dtx" , "*.ins" ]), |
252 | ("texinfo" , &["*.texi" ]), |
253 | ("textile" , &["*.textile" ]), |
254 | ("tf" , &["*.tf" ]), |
255 | ("thrift" , &["*.thrift" ]), |
256 | ("toml" , &["*.toml" , "Cargo.lock" ]), |
257 | ("ts" , &["*.ts" , "*.tsx" , "*.cts" , "*.mts" ]), |
258 | ("twig" , &["*.twig" ]), |
259 | ("txt" , &["*.txt" ]), |
260 | ("typoscript" , &["*.typoscript" , "*.ts" ]), |
261 | ("vala" , &["*.vala" ]), |
262 | ("vb" , &["*.vb" ]), |
263 | ("vcl" , &["*.vcl" ]), |
264 | ("verilog" , &["*.v" , "*.vh" , "*.sv" , "*.svh" ]), |
265 | ("vhdl" , &["*.vhd" , "*.vhdl" ]), |
266 | ("vim" , &[ |
267 | "*.vim" , ".vimrc" , ".gvimrc" , "vimrc" , "gvimrc" , "_vimrc" , "_gvimrc" , |
268 | ]), |
269 | ("vimscript" , &[ |
270 | "*.vim" , ".vimrc" , ".gvimrc" , "vimrc" , "gvimrc" , "_vimrc" , "_gvimrc" , |
271 | ]), |
272 | ("webidl" , &["*.idl" , "*.webidl" , "*.widl" ]), |
273 | ("wiki" , &["*.mediawiki" , "*.wiki" ]), |
274 | ("xml" , &[ |
275 | "*.xml" , "*.xml.dist" , "*.dtd" , "*.xsl" , "*.xslt" , "*.xsd" , "*.xjb" , |
276 | "*.rng" , "*.sch" , "*.xhtml" , |
277 | ]), |
278 | ("xz" , &["*.xz" , "*.txz" ]), |
279 | ("yacc" , &["*.y" ]), |
280 | ("yaml" , &["*.yaml" , "*.yml" ]), |
281 | ("yang" , &["*.yang" ]), |
282 | ("z" , &["*.Z" ]), |
283 | ("zig" , &["*.zig" ]), |
284 | ("zsh" , &[ |
285 | ".zshenv" , "zshenv" , |
286 | ".zlogin" , "zlogin" , |
287 | ".zlogout" , "zlogout" , |
288 | ".zprofile" , "zprofile" , |
289 | ".zshrc" , "zshrc" , |
290 | "*.zsh" , |
291 | ]), |
292 | ("zstd" , &["*.zst" , "*.zstd" ]), |
293 | ]; |
294 | |
295 | #[cfg (test)] |
296 | mod tests { |
297 | use super::DEFAULT_TYPES; |
298 | |
299 | #[test ] |
300 | fn default_types_are_sorted() { |
301 | let mut names = DEFAULT_TYPES.iter().map(|(name, _exts)| name); |
302 | |
303 | let Some(mut previous_name) = names.next() else { return; }; |
304 | |
305 | for name in names { |
306 | assert!( |
307 | name > previous_name, |
308 | r#"" {}" should be sorted before " {}" in `DEFAULT_TYPES`"# , |
309 | name, |
310 | previous_name |
311 | ); |
312 | |
313 | previous_name = name; |
314 | } |
315 | } |
316 | } |
317 | |