Skip to content

Commit

Permalink
Fix #1084 and add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinCampbell committed Jan 7, 2017
1 parent 1ab9c08 commit 813b83e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
16 changes: 8 additions & 8 deletions syntaxes/csharp.tmLanguage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ repository:
- include: '#type'
- include: '#punctuation-accessor'
'5': { name: entity.name.variable.property.cs }
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#property-accessors'
Expand Down Expand Up @@ -517,7 +517,7 @@ repository:
- include: '#punctuation-accessor'
'5':
name: keyword.other.this.cs
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#bracketed-parameter-list'
Expand Down Expand Up @@ -562,7 +562,7 @@ repository:
- name: entity.name.variable.event.cs
match: '[_$[:alpha:]][_$[:alnum:]]*'
- include: '#punctuation-comma'
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#event-accessors'
Expand Down Expand Up @@ -631,7 +631,7 @@ repository:
- include: '#type'
- include: '#punctuation-accessor'
'5': { name: entity.name.function.cs }
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#parenthesized-parameter-list'
Expand All @@ -643,7 +643,7 @@ repository:
begin: ([_$[:alpha:]][_$[:alnum:]]*)\s*(?=\()
beginCaptures:
'1': { name: entity.name.function.cs }
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#parenthesized-parameter-list'
Expand All @@ -666,7 +666,7 @@ repository:
beginCaptures:
'1': { name: punctuation.tilde.cs }
'2': { name: entity.name.function.cs }
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#parenthesized-parameter-list'
Expand Down Expand Up @@ -698,7 +698,7 @@ repository:
# '2': ?<identifier> is a sub-expression. It's final value is not considered.
'3': { name: keyword.other.operator.cs }
'4': { name: entity.name.function.cs }
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#parenthesized-parameter-list'
Expand Down Expand Up @@ -736,7 +736,7 @@ repository:
'3':
patterns:
- include: '#type'
end: (?=\}|;)
end: (?<=\})|(?=;)
patterns:
- include: '#comment'
- include: '#parenthesized-parameter-list'
Expand Down
36 changes: 36 additions & 0 deletions test/syntaxes/methods.test.syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,5 +387,41 @@ namespace Test
Token.Punctuation.CloseBrace
]);
});

it("shadowed methods are highlighted properly (issue #1084)", () => {

const input = Input.InClass(`
private new void foo1() //Correct highlight
{
}
new void foo2() //Function name not highlighted
{
}
`);
const tokens = tokenize(input);

tokens.should.deep.equal([
Token.Keywords.Modifiers.Private,
Token.Keywords.Modifiers.New,
Token.Type("void"),
Token.Identifiers.MethodName("foo1"),
Token.Punctuation.OpenParen,
Token.Punctuation.CloseParen,
Token.Comment.SingleLine.Start,
Token.Comment.SingleLine.Text("Correct highlight"),
Token.Punctuation.OpenBrace,
Token.Punctuation.CloseBrace,
Token.Keywords.Modifiers.New,
Token.Type("void"),
Token.Identifiers.MethodName("foo2"),
Token.Punctuation.OpenParen,
Token.Punctuation.CloseParen,
Token.Comment.SingleLine.Start,
Token.Comment.SingleLine.Text("Function name not highlighted"),
Token.Punctuation.OpenBrace,
Token.Punctuation.CloseBrace
]);
});
});
});

0 comments on commit 813b83e

Please sign in to comment.