mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Fixed bug where tagged templates with a literal adjacent to EOF showed sig help.
This commit is contained in:
parent
44e6bcf7ff
commit
5fd0701ce5
@ -715,7 +715,7 @@ module ts {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function emitEnumDeclaration(node: EnumDeclaration) {
|
||||
if (resolver.isDeclarationVisible(node)) {
|
||||
emitJsDocComments(node);
|
||||
@ -3558,7 +3558,7 @@ module ts {
|
||||
return leadingComments;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getLeadingCommentsToEmit(node: Node) {
|
||||
// Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments
|
||||
if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) {
|
||||
|
||||
@ -823,9 +823,10 @@ module ts {
|
||||
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;
|
||||
// If we didn't end in a backtick, we must still be in the middle of a template literal,
|
||||
// but if it's the *initial* backtick (whereby the token is 1 char long), then it's unclosed.
|
||||
var width = node.end - getTokenPosOfNode(node);
|
||||
return width < 2 || sourceText.charCodeAt(node.end - 1) !== CharacterCodes.backtick;
|
||||
}
|
||||
|
||||
export function isModifier(token: SyntaxKind): boolean {
|
||||
|
||||
@ -296,7 +296,7 @@ module ts.SignatureHelp {
|
||||
Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression);
|
||||
|
||||
// If we're just after a template tail, don't show signature help.
|
||||
if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !isUnterminatedTemplateEnd(<LiteralExpression>node)) {
|
||||
if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(<LiteralExpression>node, position)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}`/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}abcd`/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/``/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
||||
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// function foo(strs, ...rest) {
|
||||
//// }
|
||||
////
|
||||
//// /*1*/fo/*2*/o /*3*/`abcd`/*4*/ /*5*/
|
||||
|
||||
test.markers().forEach(m => {
|
||||
goTo.position(m.position);
|
||||
verify.not.signatureHelpPresent();
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user