Skip to content

Commit

Permalink
[C#] fix List<int> bar = new List<int>(); marked as function
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenzek committed Jun 22, 2016
1 parent 8620e5a commit 451e413
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
14 changes: 11 additions & 3 deletions C#/C#.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,12 @@ contexts:
set:
- match: \}
scope: punctuation.section.function.end.cs
pop: true
set:
- match: =
scope: keyword.operator.assignment.cs
set: line_of_code_in
- match: (?=\S)
pop: true
- match: \b(get)\b
scope: storage.type.function.accessor.get.cs
push: method_body
Expand All @@ -605,6 +610,9 @@ contexts:
- match: '{{visibility}}'
scope: storage.modifier.access.cs
- include: tag
- match: '=>'
scope: punctuation.section.function.begin.cs
set: line_of_code_in
- match: \S
scope: invalid.illegal
pop: true
Expand Down Expand Up @@ -722,7 +730,7 @@ contexts:

- include: keywords

- match: '{{name}}(<)(?=[^(]*>\()'
- match: '{{name}}(<)(?=[^(={}]*>\()'
captures:
0: meta.function-call
1: variable.function.cs
Expand Down Expand Up @@ -1080,7 +1088,7 @@ contexts:
- match: '(\(|\{|:)'
scope: invalid.illegal
pop: true
- match: (?=\}|\)|>|\]|,|;|>)
- match: (?=\}|\)|>|\]|,|;|>|=>)
pop: true

type_argument:
Expand Down
12 changes: 11 additions & 1 deletion C#/tests/syntax_test_Generics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@
Foo.l + 1;
/// ^ variable.other
Foo<a>.List l;
/// ^ variable.other.type
/// ^^ variable.other.type
/// ^ entity.name.variable

List<int> bar = new List<int>();
/// <- variable.other.type
/// ^^^ support.type
/// ^^^^ variable.other.type
/// ^^^ support.type

string verbatim = @"This is a test "" of a verbatim string literal - C:\User";
/// ^^ string.quoted.double punctuation.definition.string
/// ^^ constant.character.escape
Expand All @@ -51,3 +57,7 @@
/// ^ punctuation.definition.string.interpolated.end
x[10][5] = 2;
f(5)[2] = 10;
/// ^ punctuation.definition.accessor
/// ^ punctuation.definition.accessor

int? foo = 4;

0 comments on commit 451e413

Please sign in to comment.