diff --git a/src/services/services.ts b/src/services/services.ts index 589022872e..41ffc04e5a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -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)); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 756fbb4259..719aa65872 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -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); }