Skip to content

Commit 3e8babe

Browse files
Merge pull request #1271 from Microsoft/taggedSigHelpAtEnd
Fixed bug where tagged templates with a literal adjacent to EOF showed sig help past the end.
2 parents 983b9f5 + 3cd0e9f commit 3e8babe

5 files changed

+46
-2
lines changed

src/services/signatureHelp.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ module ts.SignatureHelp {
295295
var tagExpression = <TaggedTemplateExpression>templateExpression.parent;
296296
Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression);
297297

298-
// If we're just after a template tail, don't show signature help.
299-
if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !(<LiteralExpression>node).isUnterminated) {
298+
// If we're just after a template tail, don't show signature help.
299+
if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(<LiteralExpression>node, position)) {
300300
return undefined;
301301
}
302302

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// function foo(strs, ...rest) {
4+
//// }
5+
////
6+
//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}`/*4*/ /*5*/
7+
8+
test.markers().forEach(m => {
9+
goTo.position(m.position);
10+
verify.not.signatureHelpPresent();
11+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// function foo(strs, ...rest) {
4+
//// }
5+
////
6+
//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}abcd`/*4*/ /*5*/
7+
8+
test.markers().forEach(m => {
9+
goTo.position(m.position);
10+
verify.not.signatureHelpPresent();
11+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// function foo(strs, ...rest) {
4+
//// }
5+
////
6+
//// /*1*/fo/*2*/o /*3*/``/*4*/ /*5*/
7+
8+
test.markers().forEach(m => {
9+
goTo.position(m.position);
10+
verify.not.signatureHelpPresent();
11+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// function foo(strs, ...rest) {
4+
//// }
5+
////
6+
//// /*1*/fo/*2*/o /*3*/`abcd`/*4*/
7+
8+
test.markers().forEach(m => {
9+
goTo.position(m.position);
10+
verify.not.signatureHelpPresent();
11+
});

0 commit comments

Comments
 (0)