mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Skip parsing JSDoc when not needed (#52921)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
This commit is contained in:
@@ -789,6 +789,9 @@ function reportWatchModeWithoutSysSupport(sys: System, reportDiagnostic: Diagnos
|
||||
return false;
|
||||
}
|
||||
|
||||
// This could be inlined everywhere, but this is convenient for debugging and patching.
|
||||
const skipNonSemanticJSDocParsing = true;
|
||||
|
||||
function performBuild(
|
||||
sys: System,
|
||||
cb: ExecuteCommandLineCallbacks,
|
||||
@@ -839,6 +842,7 @@ function performBuild(
|
||||
createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)),
|
||||
createWatchStatusReporter(sys, buildOptions),
|
||||
);
|
||||
buildHost.skipNonSemanticJSDocParsing = skipNonSemanticJSDocParsing;
|
||||
const solutionPerformance = enableSolutionPerformance(sys, buildOptions);
|
||||
updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
|
||||
const onWatchStatusChange = buildHost.onWatchStatusChange;
|
||||
@@ -868,6 +872,7 @@ function performBuild(
|
||||
createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)),
|
||||
createReportErrorSummary(sys, buildOptions),
|
||||
);
|
||||
buildHost.skipNonSemanticJSDocParsing = skipNonSemanticJSDocParsing;
|
||||
const solutionPerformance = enableSolutionPerformance(sys, buildOptions);
|
||||
updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
|
||||
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
|
||||
@@ -890,7 +895,7 @@ function performCompilation(
|
||||
config: ParsedCommandLine,
|
||||
) {
|
||||
const { fileNames, options, projectReferences } = config;
|
||||
const host = createCompilerHostWorker(options, /*setParentNodes*/ undefined, sys);
|
||||
const host = createCompilerHostWorker(options, /*setParentNodes*/ undefined, skipNonSemanticJSDocParsing, sys);
|
||||
const currentDirectory = host.getCurrentDirectory();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
||||
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName));
|
||||
@@ -923,7 +928,7 @@ function performIncrementalCompilation(
|
||||
) {
|
||||
const { options, fileNames, projectReferences } = config;
|
||||
enableStatisticsAndTracing(sys, options, /*isBuildMode*/ false);
|
||||
const host = createIncrementalCompilerHost(options, sys);
|
||||
const host = createIncrementalCompilerHost(options, sys, skipNonSemanticJSDocParsing);
|
||||
const exitStatus = ts_performIncrementalCompilation({
|
||||
host,
|
||||
system: sys,
|
||||
@@ -975,6 +980,7 @@ function updateWatchCompilationHost(
|
||||
cb: ExecuteCommandLineCallbacks,
|
||||
watchCompilerHost: WatchCompilerHost<EmitAndSemanticDiagnosticsBuilderProgram>,
|
||||
) {
|
||||
watchCompilerHost.skipNonSemanticJSDocParsing = skipNonSemanticJSDocParsing;
|
||||
updateCreateProgram(sys, watchCompilerHost, /*isBuildMode*/ false);
|
||||
const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217
|
||||
watchCompilerHost.afterProgramCreate = builderProgram => {
|
||||
|
||||
Reference in New Issue
Block a user