Add C# syntax option to highlight selections (#12511)

Summary
- map csharp/c-sharp aliases to the existing C# syntax in the highlight
matcher
- ensure the extension list and tests include .cs and the new aliases so
coverage stays accurate

Testing

<img width="543" height="266" alt="image"
src="https://github.com/user-attachments/assets/e6c8a42f-649c-4c30-b574-421b4287534c"
/>
This commit is contained in:
Eric Traut
2026-02-22 12:15:20 -08:00
committed by GitHub
parent 5684c82e45
commit d5fef5c190

View File

@@ -403,6 +403,7 @@ fn find_syntax(lang: &str) -> Option<&'static SyntaxReference> {
// Aliases that two-face does not resolve on its own. // Aliases that two-face does not resolve on its own.
let patched = match lang { let patched = match lang {
"csharp" | "c-sharp" => "c#",
"golang" => "go", "golang" => "go",
"python3" => "python", "python3" => "python",
"shell" => "bash", "shell" => "bash",
@@ -806,6 +807,7 @@ mod tests {
"zig", "zig",
"swift", "swift",
"java", "java",
"c#",
"elixir", "elixir",
"haskell", "haskell",
"scala", "scala",
@@ -829,7 +831,7 @@ mod tests {
// Common file extensions. // Common file extensions.
let extensions = [ let extensions = [
"rs", "py", "js", "ts", "rb", "go", "sh", "md", "yml", "kt", "ex", "hs", "pl", "php", "rs", "py", "js", "ts", "rb", "go", "sh", "md", "yml", "kt", "ex", "hs", "pl", "php",
"css", "html", "css", "html", "cs",
]; ];
for ext in extensions { for ext in extensions {
assert!( assert!(
@@ -838,7 +840,7 @@ mod tests {
); );
} }
// Patched aliases that two-face cannot resolve on its own. // Patched aliases that two-face cannot resolve on its own.
for alias in ["golang", "python3", "shell"] { for alias in ["csharp", "c-sharp", "golang", "python3", "shell"] {
assert!( assert!(
find_syntax(alias).is_some(), find_syntax(alias).is_some(),
"find_syntax({alias:?}) returned None — patched alias broken" "find_syntax({alias:?}) returned None — patched alias broken"