-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Add upper limit for the program size to prevent tsserver from crashing #7486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
4d3cff1
b155fa8
a3aa000
a6a466c
d4eb3b8
a839d93
225e3b4
c8e0b00
d7e1d34
cb46f16
74e3d7b
1b76294
5c9ce9e
94d44ad
d387050
4383f1a
e41b10b
3354436
550d912
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -407,6 +407,10 @@ namespace ts { | |
| }, | ||
| description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon | ||
| }, | ||
| { | ||
| name: "disableProjectSizeLimit", | ||
| type: "boolean" | ||
| }, | ||
| { | ||
| name: "strictNullChecks", | ||
| type: "boolean", | ||
|
|
@@ -723,10 +727,22 @@ namespace ts { | |
| const supportedExtensions = getSupportedExtensions(options); | ||
| Debug.assert(indexOf(supportedExtensions, ".ts") < indexOf(supportedExtensions, ".d.ts"), "Changed priority of extensions to pick"); | ||
|
|
||
| const potentialFiles: string[] = []; | ||
| if (host.readDirectoryWithMultipleExtensions) { | ||
| addRange(potentialFiles, host.readDirectoryWithMultipleExtensions(basePath, supportedExtensions, exclude)); | ||
|
||
| } | ||
| else { | ||
| for (const extension of supportedExtensions) { | ||
| addRange(potentialFiles, host.readDirectory(basePath, extension, exclude)); | ||
| } | ||
| } | ||
| // Get files of supported extensions in their order of resolution | ||
| for (const extension of supportedExtensions) { | ||
| const filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); | ||
| for (const fileName of filesInDirWithExtension) { | ||
| for (const fileName of potentialFiles) { | ||
| if (!fileExtensionIs(fileName, extension)) { | ||
| continue; | ||
| } | ||
|
|
||
| // .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension, | ||
| // lets pick them when its turn comes up | ||
| if (extension === ".ts" && fileExtensionIs(fileName, ".d.ts")) { | ||
|
|
@@ -746,8 +762,10 @@ namespace ts { | |
| } | ||
| } | ||
|
|
||
| filesSeen[fileName] = true; | ||
| fileNames.push(fileName); | ||
| if (!filesSeen[fileName]) { | ||
| filesSeen[fileName] = true; | ||
| fileNames.push(fileName); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were re-reading the directory for every file extension in the list? Crazy!! Good find 😄