Skip to content

Port #7486 to release 1.8 #7513

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

Merged
merged 13 commits into from
Mar 15, 2016

Conversation

zhengbli
Copy link
Contributor

No description provided.

if (rootLevelDirectory[rootLevelDirectory.length - 1] !== directorySeparator) {
rootLevelDirectory += directorySeparator;
}
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Too_many_JavaScript_files_in_the_project_Consider_specifying_the_exclude_setting_in_project_configuration_to_limit_included_source_folders_The_likely_folder_to_exclude_is_0_To_disable_the_project_size_limit_set_the_disableSizeLimit_compiler_option_to_true, rootLevelDirectory));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you are actually reporting this on the next file after the file that pushed over the size limit. So if the compiler was loading a massive file "./tmp/bundle.js" that was 20MB, followed by "./src/app.js" that was 1MB, you'd report on "./src". You're also reporting before you call host.getSourceFile, so the file/folder reported as being too large may not even exit.

Any reason you are not reporting and setting to -1 after you call host.getSourceFile and add the length to programSizeForNonTsFiles below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree it makes more sense to report error right after the file exceeding the limit. Updating

@billti
Copy link
Member

billti commented Mar 15, 2016

I made a comment in email about ensuring we don't flood with file not found errors once we start skipping file loading. If you've verified that, as well as done some other manual testing of good/bad scenarios to ensure it all behaves as expected, then looks good to me! 👍 Thanks!

@zhengbli zhengbli force-pushed the projectSizeLimitFor18-2 branch from 90763f9 to f13a9c7 Compare March 15, 2016 09:28
@@ -1031,8 +1033,10 @@ namespace ts {
diagnosticArgument = [fileName, "'" + supportedExtensions.join("', '") + "'"];
}
else if (!findSourceFile(fileName, toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
if (hasTypeScriptFileExtension(fileName) || options.disableSizeLimit || programSizeForNonTsFiles !== -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This magic -1 value is being used in a few places now. Can you make this a const with a meaningful name and use that to make the code more readable (e.g. const sizeLimitExceeded = -1). It would also help readability if this was a simple helper function (e.g. function sizeLimitExceed() { return !options.disableLimit && programSizeForNonTsFiles === sizeLimitExceeded;}) used in these conditions.

diagnostic = Diagnostics.File_0_not_found;
fileName += ".ts";
diagnosticArgument = [fileName];
if (!exceedProgramSizeLimit()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would add it below. somethig like

if (diagnostic && !exceedProgramSizeLimit())

@mhegazy
Copy link
Contributor

mhegazy commented Mar 15, 2016

👍

@billti
Copy link
Member

billti commented Mar 15, 2016

👍 Thanks!

zhengbli added a commit that referenced this pull request Mar 15, 2016
@zhengbli zhengbli merged commit b23503c into microsoft:release-1.8 Mar 15, 2016
@zhengbli zhengbli deleted the projectSizeLimitFor18-2 branch March 15, 2016 23:03
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants