Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ declare function setTimeout(handler: (...args: any[]) => void, timeout: number):
declare function clearTimeout(handle: any): void;

namespace ts {
/**
* Set a high stack trace limit to provide more information in case of an error.
* Called for command-line and server use cases.
* Not called if TypeScript is used as a library.
*/
/* @internal */
export function setStackTraceLimit() {
if ((Error as any).stackTraceLimit < 100) { // Also tests that we won't set the property if it doesn't exist.
(Error as any).stackTraceLimit = 100;
}
}

export enum FileWatcherEventKind {
Created,
Changed,
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ namespace ts {
}
}

ts.setStackTraceLimit();

if (ts.Debug.isDebugging) {
ts.Debug.enableDebugInfo();
}
Expand Down
2 changes: 2 additions & 0 deletions src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ namespace ts.server {
validateLocaleAndSetLanguage(localeStr, sys);
}

setStackTraceLimit();

const typingSafeListLocation = findArgument(Arguments.TypingSafeListLocation);
const npmLocation = findArgument(Arguments.NpmLocation);

Expand Down