Skip to content

Commit be73f73

Browse files
previousToken -> contextToken
1 parent a7983a4 commit be73f73

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/services/services.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,11 +3142,11 @@ namespace ts {
31423142
return scope;
31433143
}
31443144

3145-
function isCompletionListBlocker(previousToken: Node): boolean {
3145+
function isCompletionListBlocker(contextToken: Node): boolean {
31463146
let start = new Date().getTime();
3147-
let result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) ||
3148-
isIdentifierDefinitionLocation(previousToken) ||
3149-
isRightOfIllegalDot(previousToken);
3147+
let result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken) ||
3148+
isIdentifierDefinitionLocation(contextToken) ||
3149+
isRightOfIllegalDot(contextToken);
31503150
log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start));
31513151
return result;
31523152
}
@@ -3225,12 +3225,12 @@ namespace ts {
32253225
return false;
32263226
}
32273227

3228-
function isInStringOrRegularExpressionOrTemplateLiteral(previousToken: Node): boolean {
3229-
if (previousToken.kind === SyntaxKind.StringLiteral
3230-
|| previousToken.kind === SyntaxKind.RegularExpressionLiteral
3231-
|| isTemplateLiteralKind(previousToken.kind)) {
3232-
let start = previousToken.getStart();
3233-
let end = previousToken.getEnd();
3228+
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken: Node): boolean {
3229+
if (contextToken.kind === SyntaxKind.StringLiteral
3230+
|| contextToken.kind === SyntaxKind.RegularExpressionLiteral
3231+
|| isTemplateLiteralKind(contextToken.kind)) {
3232+
let start = contextToken.getStart();
3233+
let end = contextToken.getEnd();
32343234

32353235
// To be "in" one of these literals, the position has to be:
32363236
// 1. entirely within the token text.
@@ -3241,8 +3241,8 @@ namespace ts {
32413241
}
32423242

32433243
if (position === end) {
3244-
return !!(<LiteralExpression>previousToken).isUnterminated ||
3245-
previousToken.kind === SyntaxKind.RegularExpressionLiteral;
3244+
return !!(<LiteralExpression>contextToken).isUnterminated ||
3245+
contextToken.kind === SyntaxKind.RegularExpressionLiteral;
32463246
}
32473247
}
32483248

@@ -3316,10 +3316,10 @@ namespace ts {
33163316
return false;
33173317
}
33183318

3319-
function isIdentifierDefinitionLocation(previousToken: Node): boolean {
3320-
if (previousToken) {
3321-
let containingNodeKind = previousToken.parent.kind;
3322-
switch (previousToken.kind) {
3319+
function isIdentifierDefinitionLocation(contextToken: Node): boolean {
3320+
if (contextToken) {
3321+
let containingNodeKind = contextToken.parent.kind;
3322+
switch (contextToken.kind) {
33233323
case SyntaxKind.CommaToken:
33243324
return containingNodeKind === SyntaxKind.VariableDeclaration ||
33253325
containingNodeKind === SyntaxKind.VariableDeclarationList ||
@@ -3351,9 +3351,9 @@ namespace ts {
33513351

33523352
case SyntaxKind.SemicolonToken:
33533353
return containingNodeKind === SyntaxKind.PropertySignature &&
3354-
previousToken.parent && previousToken.parent.parent &&
3355-
(previousToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
3356-
previousToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
3354+
contextToken.parent && contextToken.parent.parent &&
3355+
(contextToken.parent.parent.kind === SyntaxKind.InterfaceDeclaration || // interface a { f; |
3356+
contextToken.parent.parent.kind === SyntaxKind.TypeLiteral); // let x : { a; |
33573357

33583358
case SyntaxKind.LessThanToken:
33593359
return containingNodeKind === SyntaxKind.ClassDeclaration || // class A< |
@@ -3366,8 +3366,8 @@ namespace ts {
33663366

33673367
case SyntaxKind.DotDotDotToken:
33683368
return containingNodeKind === SyntaxKind.Parameter ||
3369-
(previousToken.parent && previousToken.parent.parent &&
3370-
previousToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [...z|
3369+
(contextToken.parent && contextToken.parent.parent &&
3370+
contextToken.parent.parent.kind === SyntaxKind.ArrayBindingPattern); // var [...z|
33713371

33723372
case SyntaxKind.PublicKeyword:
33733373
case SyntaxKind.PrivateKeyword:
@@ -3390,7 +3390,7 @@ namespace ts {
33903390
}
33913391

33923392
// Previous token may have been a keyword that was converted to an identifier.
3393-
switch (previousToken.getText()) {
3393+
switch (contextToken.getText()) {
33943394
case "class":
33953395
case "interface":
33963396
case "enum":
@@ -3407,9 +3407,9 @@ namespace ts {
34073407
return false;
34083408
}
34093409

3410-
function isRightOfIllegalDot(previousToken: Node): boolean {
3411-
if (previousToken && previousToken.kind === SyntaxKind.NumericLiteral) {
3412-
let text = previousToken.getFullText();
3410+
function isRightOfIllegalDot(contextToken: Node): boolean {
3411+
if (contextToken && contextToken.kind === SyntaxKind.NumericLiteral) {
3412+
let text = contextToken.getFullText();
34133413
return text.charAt(text.length - 1) === ".";
34143414
}
34153415

0 commit comments

Comments
 (0)