Skip to content

Commit c0eb472

Browse files
author
Andy Hanson
committed
Classify this in parameter position as a keyword
1 parent ba78d1e commit c0eb472

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/services/services.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7533,7 +7533,8 @@ namespace ts {
75337533
return;
75347534
case SyntaxKind.Parameter:
75357535
if ((<ParameterDeclaration>token.parent).name === token) {
7536-
return ClassificationType.parameterName;
7536+
const isThis = token.kind === SyntaxKind.Identifier && (<Identifier>token).originalKeywordKind === SyntaxKind.ThisKeyword;
7537+
return isThis ? ClassificationType.keyword : ClassificationType.parameterName;
75377538
}
75387539
return;
75397540
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////function f(this){}
4+
5+
var c = classification;
6+
verify.syntacticClassificationsAre(
7+
c.keyword("function"),
8+
c.identifier("f"),
9+
c.punctuation("("),
10+
c.keyword("this"),
11+
c.punctuation(")"),
12+
c.punctuation("{"),
13+
c.punctuation("}"));

0 commit comments

Comments
 (0)