diff --git a/CHANGES.md b/CHANGES.md index 2858a2b664..a5eb85b1b1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ Grammars: +- fix(csharp) add missing `catch` keyword (#3251) [Konrad Rudolph][] - add additional keywords to csp.js (#3244) [Elijah Conners][] - fix(markdown) Images with empty alt or links with empty text (#3233) [Josh Goebel][] - enh(powershell) added `pwsh` alias (#3236) [tebeco][] diff --git a/src/languages/csharp.js b/src/languages/csharp.js index 6696d4f060..b89704d4bc 100644 --- a/src/languages/csharp.js +++ b/src/languages/csharp.js @@ -59,6 +59,7 @@ export default function(hljs) { 'base', 'break', 'case', + 'catch', 'class', 'const', 'continue', diff --git a/test/markup/csharp/try-catch.expect.txt b/test/markup/csharp/try-catch.expect.txt new file mode 100644 index 0000000000..2925c46c70 --- /dev/null +++ b/test/markup/csharp/try-catch.expect.txt @@ -0,0 +1,8 @@ +try +{ + throw new InvalidCastException(); +} +catch (InvalidCastException e) when (e.Data != null) +{ + throw; +} \ No newline at end of file diff --git a/test/markup/csharp/try-catch.txt b/test/markup/csharp/try-catch.txt new file mode 100644 index 0000000000..c9f0430dc0 --- /dev/null +++ b/test/markup/csharp/try-catch.txt @@ -0,0 +1,8 @@ +try +{ + throw new InvalidCastException(); +} +catch (InvalidCastException e) when (e.Data != null) +{ + throw; +}