GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add upper limit for the program size to prevent tsserver from crashing by zhengbli · Pull Request #7486 · microsoft/TypeScript Conversation
|
| "category": "Error", | ||
| "code": 17010 | ||
| }, | ||
| "Too many javascript files in the project. Consider add to the `exclude` list in the config file.": { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Grammar: "Consider adding to...". Or perhaps just reworded as "Use the 'exclude' setting in project configuration to limit included source folders".
Note: Do we predicate this message on the user not having listed the files to compile? If we are not scanning directories anyway (i.e. there is a list of files given), then this message would be misleading (as exclude can't be specified - at least until the globbing change comes in).
Also, capitalize as "JavaScript", not "javascript", and don't use backticks. This isn't markdown :-p
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I agree that we should mention both cases, with or without the "exclude" list. Does the following sound better:
"Too many JavaScript files in the project. Use an exact 'files' list, or use the 'exclude' setting in project configuration to limit included source folders."
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I like it :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Added some comments. Note this pull request should be against |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return node.flags & NodeFlags.AccessibilityModifier && node.parent.kind === SyntaxKind.Constructor && isClassLike(node.parent.parent); | ||
| } | ||
|
|
||
| export const maxProgramSize = 20 * 1024 * 1024; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Changed the upper limit from 35M to 20M, as on my machine even 35M would still run out of memory
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| name: "disableSizeLimit", | ||
| type: "boolean", | ||
| description: Diagnostics.Disable_the_upper_limit_for_the_total_file_size_of_a_project |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
remove the description, so that it does not show in the help.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Bill Ticehurst (@billti) Mohamed Hegazy (@mhegazy) Vladimir Matveev (@vladima) Please review the updated code, I'll try to merge into 1.8 once this PR got thumbs up. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| if (!options.disableSizeLimit) { | ||
| if (programSizeForNonTsFiles === -1) { | ||
| return; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
nit. return undefined;
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Port #7486 to release 1.8
… fixLargeProjectTry2 # Conflicts: # src/compiler/types.ts
… fixLargeProjectTry2
36b8172 to
cb46f16
Compare
|
With the new updates, the response time for the first "ProjectInfo" request was reduced to around 5s from 40+s for the repro sample at #7444 originally, due to avoiding creating programs for the project and speeding up in the file traversing process. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| // Get files of supported extensions in their order of resolution | ||
| for (const extension of supportedExtensions) { | ||
| const filesInDirWithExtension = host.readDirectory(basePath, extension, exclude); |
There was a problem 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 😄
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Looks good at first read. We should add the same logic on the VS host side also to improve Salsa experience there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… fixLargeProjectTry2 # Conflicts: # src/compiler/commandLineParser.ts # src/compiler/types.ts
… fixLargeProjectTry2 # Conflicts: # src/compiler/sys.ts
| } | ||
| }); | ||
|
|
||
| if (!options.disableSizeLimit && file && file.text && !hasTypeScriptFileExtension(file.fileName)) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
looks like we do not need this in the program building, since we are doing it in the server.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… fixLargeProjectTry2 # Conflicts: # src/compiler/commandLineParser.ts # src/compiler/program.ts # src/compiler/sys.ts # src/compiler/types.ts # src/server/editorServices.ts # src/server/session.ts
|
|
||
| const potentialFiles: string[] = []; | ||
| if (host.readDirectoryWithMultipleExtensions) { | ||
| addRange(potentialFiles, host.readDirectoryWithMultipleExtensions(basePath, supportedExtensions, exclude)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I believe this already handled by Richard Knoll (@riknoll) in #8841. can we make sure we are doing one approach for both PRs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
possibly split this in a separate PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sure.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We need a unit test for this, now that we have unit tests :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Vladimir Matveev (@vladima) any comments? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c0e232e to
e41b10b
Compare
|
Mohamed Hegazy (@mhegazy) updated with a test |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| else { | ||
| const oldFileNames = project.compilerService.host.roots.map(info => info.fileName); | ||
| if (this.exceedTotalNonTsFileSizeLimit(projectOptions.files) && projectOptions.compilerOptions && !projectOptions.compilerOptions.disableSizeLimit) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
move this !projectOptions.compilerOptions.disableSizeLimit to the beginning.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
… fixLargeProjectTry2 # Conflicts: # src/compiler/program.ts # tests/cases/unittests/tsserverProjectSystem.ts
c6f9e25 to
550d912
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
JS error highlighting stops working in some cases tsserver crashes with large projects
There was an error while loading. Please reload this page.