Improve JSON detection

remove_eq_on_syntax
Wilfred Hughes 2022-04-23 18:55:13 +07:00
parent 664c1883f6
commit c8c7d3570e
2 changed files with 10 additions and 1 deletions

@ -4,6 +4,9 @@
Added support for Perl.
Improved language detection for JSON. More file extensions and file
names are recognised as JSON, e.g. `.jsonl`.
### Display
Fixed crash in inline mode.

@ -178,6 +178,9 @@ fn from_name(path: &Path) -> Option<Language> {
| "gradlew" | "kshrc" | "login" | "man" | "profile" | "zlogin" | "zlogout"
| "zprofile" | "zshenv" | "zshrc" => Some(Bash),
".emacs" | "_emacs" | "Cask" => Some(EmacsLisp),
".arcconfig" | ".auto-changelog" | ".c8rc" | ".htmlhintrc" | ".imgbotconfig"
| ".nycrc" | ".tern-config" | ".tern-project" | ".watchmanconfig" | "Pipfile.lock"
| "composer.lock" | "mcmod.info" => Some(Json),
"TARGETS" | "BUCK" | "DEPS" => Some(Python),
"Gemfile" | "Rakefile" => Some(Ruby),
"Cargo.lock" | "Gopkg.lock" | "Pipfile" | "poetry.lock" => Some(Toml),
@ -213,7 +216,10 @@ pub fn from_extension(extension: &OsStr) -> Option<Language> {
"java" => Some(Java),
"cjs" | "js" | "mjs" => Some(JavaScript),
"jsx" => Some(Jsx),
"json" => Some(Json),
"json" | "avsc" | "geojson" | "gltf" | "har" | "ice" | "JSON-tmLanguage" | "jsonl"
| "mcmeta" | "tfstate" | "tfstate.backup" | "topojson" | "webapp" | "webmanifest" => {
Some(Json)
}
"kt" | "ktm" | "kts" => Some(Kotlin),
"lua" => Some(Lua),
"nix" => Some(Nix),