diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ba5cdf044f3..ead84957731 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -403,6 +403,8 @@ module ts { templateSpans: NodeArray; } + // Each of these corresponds to a substitution expression and a template literal, in that order. + // The template literal must have kind TemplateMiddleLiteral or TemplateTailLiteral. export interface TemplateSpan extends Node { expression: Expression; literal: LiteralExpression; @@ -440,8 +442,7 @@ module ts { export interface TaggedTemplateExpression extends Expression { tag: Expression; - // Either a LiteralExpression of kind NoSubstitutionTemplateLiteral, or a TemplateExpression - template: Expression; + template: LiteralExpression | TemplateExpression; } export interface TypeAssertion extends Expression { diff --git a/src/services/services.ts b/src/services/services.ts index 9b48900f933..d208eb87e96 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2471,12 +2471,12 @@ module ts { } function isCompletionListBlocker(previousToken: Node): boolean { - return isInStringOrRegularExpressionLiteral(previousToken) || + return isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); } - function isInStringOrRegularExpressionLiteral(previousToken: Node): boolean { + function isInStringOrRegularExpressionOrTemplateLiteral(previousToken: Node): boolean { if (previousToken.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(previousToken.kind)) { // The position has to be either: 1. entirely within the token text, or // 2. at the end position, and the string literal is not terminated