Skip to content

Commit 76b78a4

Browse files
committed
Fix crash in signatureHelp
1 parent 3a2f6a3 commit 76b78a4

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/services/signatureHelp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ namespace ts.SignatureHelp {
452452
}
453453

454454
function getContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile, checker: TypeChecker, isManuallyInvoked: boolean): ArgumentListInfo | undefined {
455-
for (let n = node; isManuallyInvoked || (!isBlock(n) && !isSourceFile(n)); n = n.parent) {
455+
for (let n = node; !isSourceFile(n) && (isManuallyInvoked || !isBlock(n)); n = n.parent) {
456456
// If the node is not a subspan of its parent, this is a big problem.
457457
// There have been crashes that might be caused by this violation.
458458
Debug.assert(rangeContainsRange(n.parent, n), "Not a subspan", () => `Child: ${Debug.showSyntaxKind(n)}, parent: ${Debug.showSyntaxKind(n.parent)}`);

src/tsserver/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,4 +967,8 @@ namespace ts.server {
967967
(process as any).noAsar = true;
968968
// Start listening
969969
ioSession.listen();
970+
971+
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
972+
ts.sys.tryEnableSourceMapsForHost();
973+
}
970974
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////console.log()
4+
/////**/
5+
6+
verify.noSignatureHelpForTriggerReason({ kind: "invoked" }, "");

0 commit comments

Comments
 (0)