BlueGit

ict rusty-teams

Files

rusty-teams / vendor / gpui-component / src / highlighter / language_name.rs

language_name.rs

language_name.rs 1.2 KiB Download Raw
1use gpui::SharedString;
2
3/// Built-in aliases for editing defaults when no exact grammar name is registered.
4/// Availability of a parser does not change what a language name means.
5pub(crate) fn language_name(name: &str) -> SharedString {
6 let name = name.to_lowercase();
7 match name.as_str() {
8 "plain" => "text".into(),
9 "plaintext" => "text".into(),
10 "jsonc" => "json".into(),
11 "sh" => "bash".into(),
12 "c++" => "cpp".into(),
13 "cs" => "csharp".into(),
14 "scss" => "css".into(),
15 "ex" => "elixir".into(),
16 "js" => "javascript".into(),
17 "kt" => "kotlin".into(),
18 "kts" => "kotlin".into(),
19 "ktm" => "kotlin".into(),
20 "makefile" => "make".into(),
21 "md" => "markdown".into(),
22 "mdx" => "markdown".into(),
23 "markdown-inline" => "markdown_inline".into(),
24 "php3" => "php".into(),
25 "php4" => "php".into(),
26 "php5" => "php".into(),
27 "phtml" => "php".into(),
28 "protobuf" => "proto".into(),
29 "py" => "python".into(),
30 "rb" => "ruby".into(),
31 "rs" => "rust".into(),
32 "ts" => "typescript".into(),
33 "yml" => "yaml".into(),
34 "pyi" => "python".into(),
35 _ => name.into(),
36 }
37}