Adjust the context token if the previous token is a word, not just if it's an identifier.

This commit is contained in:
Daniel Rosenwasser 2015-03-25 16:37:41 -07:00
parent a56233f17d
commit 0437dfb594
2 changed files with 2 additions and 2 deletions

View file

@ -2486,7 +2486,7 @@ module ts {
// 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|
// Skip this partial identifier and adjust the contextToken to the token that precedes it.
if (contextToken && position <= contextToken.end && contextToken.kind === SyntaxKind.Identifier) {
if (contextToken && position <= contextToken.end && isWord(contextToken.kind)) {
let start = new Date().getTime();
contextToken = findPrecedingToken(contextToken.getFullStart(), sourceFile);
log("getCompletionData: Get previous token 2: " + (new Date().getTime() - start));

View file

@ -450,7 +450,7 @@ module ts {
return n.kind >= SyntaxKind.FirstToken && n.kind <= SyntaxKind.LastToken;
}
function isWord(kind: SyntaxKind): boolean {
export function isWord(kind: SyntaxKind): boolean {
return kind === SyntaxKind.Identifier || isKeyword(kind);
}