Skip to content

Commit

Permalink
Fix crash in signatureHelp
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Jan 23, 2019
1 parent 648a795 commit b42192e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/signatureHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ namespace ts.SignatureHelp {
}

function getContainingArgumentInfo(node: Node, position: number, sourceFile: SourceFile, checker: TypeChecker, isManuallyInvoked: boolean): ArgumentListInfo | undefined {
for (let n = node; isManuallyInvoked || (!isBlock(n) && !isSourceFile(n)); n = n.parent) {
for (let n = node; !isSourceFile(n) && (isManuallyInvoked || !isBlock(n)); n = n.parent) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
Debug.assert(rangeContainsRange(n.parent, n), "Not a subspan", () => `Child: ${Debug.showSyntaxKind(n)}, parent: ${Debug.showSyntaxKind(n.parent)}`);
Expand Down
4 changes: 4 additions & 0 deletions src/tsserver/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,4 +967,8 @@ namespace ts.server {
(process as any).noAsar = true;
// Start listening
ioSession.listen();

if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
ts.sys.tryEnableSourceMapsForHost();
}
}
6 changes: 6 additions & 0 deletions tests/cases/fourslash/signatureHelpAtEOF2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference path='fourslash.ts' />

////console.log()
/////**/

verify.noSignatureHelpForTriggerReason({ kind: "invoked" }, "");

0 comments on commit b42192e

Please sign in to comment.