Merge pull request #1204 from Microsoft/taggedSigHelp

Tagged Template Signature Help Support in Language Service
This commit is contained in:
Daniel Rosenwasser committed 2014-11-24 17:48:12 -08:00
commit 229eb2afc2
46 files changed
+727 -118

No files matched your search

+15 -1
View File
@@ -487,6 +487,15 @@ module ts {
}
}
export function getInvokedExpression(node: CallLikeExpression): Expression {
if (node.kind === SyntaxKind.TaggedTemplateExpression) {
return (<TaggedTemplateExpression>node).tag;
}
// Will either be a CallExpression or NewExpression.
return (<CallExpression>node).func;
}
export function isExpression(node: Node): boolean {
switch (node.kind) {
case SyntaxKind.ThisKeyword:
@@ -801,7 +810,7 @@ module ts {
}
export function isUnterminatedTemplateEnd(node: LiteralExpression) {
Debug.assert(node.kind === SyntaxKind.NoSubstitutionTemplateLiteral || node.kind === SyntaxKind.TemplateTail);
Debug.assert(isTemplateLiteralKind(node.kind));
var sourceText = getSourceFileOfNode(node).text;
// If we're not at the EOF, we know we must be terminated.
@@ -809,6 +818,11 @@ module ts {
return false;
}
// The literal can only be unterminated if it is a template tail or a no-sub template.
if (node.kind !== SyntaxKind.TemplateTail && node.kind !== SyntaxKind.NoSubstitutionTemplateLiteral) {
return false;
}
// If we didn't end in a backtick, we must still be in the middle of a template.
// If we did, make sure that it's not the *initial* backtick.
return sourceText.charCodeAt(node.end - 1) !== CharacterCodes.backtick || node.text.length === 0;