Merge pull request #1204 from Microsoft/taggedSigHelp

Tagged Template Signature Help Support in Language Service
This commit is contained in:
Daniel Rosenwasser
2014-11-24 17:48:12 -08:00
46 changed files with 727 additions and 118 deletions
+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;
+1 -1
View File
@@ -760,7 +760,7 @@ module ts {
getAugmentedPropertiesOfType(type: Type): Symbol[];
getRootSymbols(symbol: Symbol): Symbol[];
getContextualType(node: Node): Type;
getResolvedSignature(node: CallExpression, candidatesOutArray?: Signature[]): Signature;
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature;
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature;
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
isUndefinedSymbol(symbol: Symbol): boolean;