diff --git a/C#/C#.sublime-syntax b/C#/C#.sublime-syntax index efc23e6004..d4551fd875 100644 --- a/C#/C#.sublime-syntax +++ b/C#/C#.sublime-syntax @@ -207,7 +207,7 @@ contexts: 2: meta.path.cs 3: keyword.operator.assignment.cs push: using_namespace - - match: '\b(using)(?:\s+(static))?\b' + - match: '\b(using)(?!\s*\()(?:\s+(static))?\b' captures: 1: keyword.control.import.cs 2: keyword.control.import.cs diff --git a/C#/tests/syntax_test_Using.cs b/C#/tests/syntax_test_Using.cs index aad805d1c0..925735dbe9 100755 --- a/C#/tests/syntax_test_Using.cs +++ b/C#/tests/syntax_test_Using.cs @@ -110,3 +110,31 @@ internal sealed partial class Test : global::System.Configuration.ApplicationSet } } } + +class Bar { + public void Main () + { + using(var reader = SomeCodeThatGetsAnIDisposable()) +/// ^^^^^ keyword.control.using.cs +/// ^ punctuation.section.group.begin.cs +/// ^^^ storage.type.variable.cs +/// ^ punctuation.section.group.end.cs + { + foreach(var line in reader) + { + DoStuff(line); + } + } + using (var reader = SomeCodeThatGetsAnIDisposable()) +/// ^^^^^ keyword.control.using.cs +/// ^ punctuation.section.group.begin.cs +/// ^^^ storage.type.variable.cs +/// ^ punctuation.section.group.end.cs + { + foreach (var line in reader) + { + DoStuff(line); + } + } + } +}