Fix crash in signatureHelp

This commit is contained in:
Ron Buckton 2019-01-22 15:02:30 -08:00
parent 3a2f6a3ed1
commit 76b78a4df5
3 changed files with 11 additions and 1 deletions

View File

@ -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)}`);

View File

@ -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();
}
}

View File

@ -0,0 +1,6 @@
/// <reference path='fourslash.ts' />
////console.log()
/////**/
verify.noSignatureHelpForTriggerReason({ kind: "invoked" }, "");