Skip to content

Commit 0437dfb

Browse files
Adjust the context token if the previous token is a word, not just if it's an identifier.
1 parent a56233f commit 0437dfb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2486,7 +2486,7 @@ module ts {
24862486

24872487
// Check if the caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS|
24882488
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
2489-
if (contextToken && position <= contextToken.end && contextToken.kind === SyntaxKind.Identifier) {
2489+
if (contextToken && position <= contextToken.end && isWord(contextToken.kind)) {
24902490
let start = new Date().getTime();
24912491
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile);
24922492
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start));

src/services/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ module ts {
450450
return n.kind >= SyntaxKind.FirstToken && n.kind <= SyntaxKind.LastToken;
451451
}
452452

453-
function isWord(kind: SyntaxKind): boolean {
453+
export function isWord(kind: SyntaxKind): boolean {
454454
return kind === SyntaxKind.Identifier || isKeyword(kind);
455455
}
456456

0 commit comments

Comments
 (0)