-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Port #7486 to release 1.8 #7513
Conversation
# Conflicts: # src/compiler/commandLineParser.ts # src/compiler/diagnosticMessages.json
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)); |
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.
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?
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.
I agree it makes more sense to report error right after the file exceeding the limit. Updating
I made a comment in email about ensuring we don't flood with |
90763f9
to
f13a9c7
Compare
@@ -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) { |
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.
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()) { |
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.
i would add it below. somethig like
if (diagnostic && !exceedProgramSizeLimit())
👍 |
👍 Thanks! |
No description provided.