Skip to content

Commit 8ad73bd

Browse files
committed
Make initialLoadPending as property instead of method
1 parent 0bc84cd commit 8ad73bd

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/server/editorServices.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ function forEachAncestorProject<T>(
716716
while (true) {
717717
// Skip if project is not composite and we are only looking for solution
718718
if (
719-
!project.isInitialLoadPending() &&
719+
!project.initialLoadPending &&
720720
(
721721
!project.getCompilerOptions().composite ||
722722
project.getCompilerOptions().disableSolutionSearching
@@ -746,7 +746,7 @@ function forEachAncestorProject<T>(
746746

747747
// If this ancestor is new and was delay loaded, then set the project as potential project reference
748748
if (
749-
ancestor.project.isInitialLoadPending() &&
749+
ancestor.project.initialLoadPending &&
750750
project.getCompilerOptions().composite
751751
) {
752752
// Set a potential project reference
@@ -909,7 +909,7 @@ function forEachAnyProjectReferenceKind<T>(
909909
): T | undefined {
910910
return project.getCurrentProgram() ?
911911
project.forEachResolvedProjectReference(cb) :
912-
project.isInitialLoadPending() ?
912+
project.initialLoadPending ?
913913
forEachPotentialProjectReference(project, cbPotentialProjectRef) :
914914
forEach(project.getProjectReferences(), cbProjectRef);
915915
}
@@ -1978,7 +1978,7 @@ export class ProjectService {
19781978
scheduledAnyProjectUpdate = true;
19791979
if (projectCanonicalPath === canonicalConfigFilePath) {
19801980
// Skip refresh if project is not yet loaded
1981-
if (project.isInitialLoadPending()) return;
1981+
if (project.initialLoadPending) return;
19821982
project.pendingUpdateLevel = ProgramUpdateLevel.Full;
19831983
project.pendingUpdateReason = loadReason;
19841984
this.delayUpdateProjectGraph(project);
@@ -2056,7 +2056,7 @@ export class ProjectService {
20562056

20572057
// If this was not already updated, and its new project, schedule for update
20582058
// Existing projects dont need to update if they were not using the changed config in any way
2059-
if (tryAddToSet(updatedProjects, projectForInfo) && projectForInfo.isInitialLoadPending()) {
2059+
if (tryAddToSet(updatedProjects, projectForInfo) && projectForInfo.initialLoadPending) {
20602060
this.delayUpdateProjectGraph(projectForInfo);
20612061
}
20622062
});
@@ -3063,7 +3063,7 @@ export class ProjectService {
30633063
* @internal
30643064
*/
30653065
reloadConfiguredProject(project: ConfiguredProject, reason: string) {
3066-
project.isInitialLoadPending = returnFalse;
3066+
project.initialLoadPending = false;
30673067
project.pendingUpdateReason = undefined;
30683068
project.pendingUpdateLevel = ProgramUpdateLevel.Update;
30693069

@@ -3895,7 +3895,7 @@ export class ProjectService {
38953895
const reason = `Reloading configured project in external project: ${externalProjectName}`;
38963896
projects.forEach(project => {
38973897
if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) {
3898-
if (!project.isInitialLoadPending()) {
3898+
if (!project.initialLoadPending) {
38993899
this.clearSemanticCache(project);
39003900
project.pendingUpdateLevel = ProgramUpdateLevel.Full;
39013901
project.pendingUpdateReason = reloadReason(reason);
@@ -4358,7 +4358,7 @@ export class ProjectService {
43584358
/** @internal */
43594359
loadAncestorProjectTree(forProjects?: ReadonlyCollection<string>) {
43604360
forProjects ??= new Set(
4361-
mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : undefined),
4361+
mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.initialLoadPending ? key : undefined),
43624362
);
43634363

43644364
const seenProjects = new Set<NormalizedPath>();

src/server/project.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ import {
109109
ResolvedTypeReferenceDirectiveWithFailedLookupLocations,
110110
resolvePackageNameToPackageJson,
111111
returnFalse,
112-
returnTrue,
113112
ScriptKind,
114113
some,
115114
sortAndDeduplicate,
@@ -435,7 +434,8 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
435434

436435
protected projectErrors: Diagnostic[] | undefined;
437436

438-
protected isInitialLoadPending: () => boolean = returnFalse;
437+
/** @internal */
438+
initialLoadPending = false;
439439

440440
/** @internal */
441441
dirty = false;
@@ -1911,7 +1911,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
19111911
}
19121912

19131913
private filesToStringWorker(writeProjectFileNames: boolean, writeFileExplaination: boolean, writeFileVersionAndText: boolean) {
1914-
if (this.isInitialLoadPending()) return "\tFiles (0) InitialLoadPending\n";
1914+
if (this.initialLoadPending) return "\tFiles (0) InitialLoadPending\n";
19151915
if (!this.program) return "\tFiles (0) NoProgram\n";
19161916
const sourceFiles = this.program.getSourceFiles();
19171917
let strBuilder = `\tFiles (${sourceFiles.length})\n`;
@@ -1991,7 +1991,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
19911991
: (files: Map<string, boolean>) => arrayFrom(files.keys());
19921992

19931993
// Update the graph only if initial configured project load is not pending
1994-
if (!this.isInitialLoadPending()) {
1994+
if (!this.initialLoadPending) {
19951995
updateProjectIfDirty(this);
19961996
}
19971997

@@ -2882,7 +2882,7 @@ export class ConfiguredProject extends Project {
28822882
projectOptions?: ProjectOptions | true;
28832883

28842884
/** @internal */
2885-
override isInitialLoadPending: () => boolean = returnTrue;
2885+
override initialLoadPending = true;
28862886

28872887
/** @internal */
28882888
sendLoadingProjectFinish = false;
@@ -2972,7 +2972,7 @@ export class ConfiguredProject extends Project {
29722972
override updateGraph(): boolean {
29732973
if (this.deferredClose) return false;
29742974
const isDirty = this.dirty;
2975-
this.isInitialLoadPending = returnFalse;
2975+
this.initialLoadPending = false;
29762976
const updateLevel = this.pendingUpdateLevel;
29772977
this.pendingUpdateLevel = ProgramUpdateLevel.Update;
29782978
let result: boolean;
@@ -3032,7 +3032,7 @@ export class ConfiguredProject extends Project {
30323032

30333033
/** @internal */
30343034
setPotentialProjectReference(canonicalConfigPath: NormalizedPath) {
3035-
Debug.assert(this.isInitialLoadPending());
3035+
Debug.assert(this.initialLoadPending);
30363036
(this.potentialProjectReferences || (this.potentialProjectReferences = new Set())).add(canonicalConfigPath);
30373037
}
30383038

tests/baselines/reference/api/typescript.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2827,7 +2827,6 @@ declare namespace ts {
28272827
private lastReportedFileNames;
28282828
private lastReportedVersion;
28292829
protected projectErrors: Diagnostic[] | undefined;
2830-
protected isInitialLoadPending: () => boolean;
28312830
private typingsCache;
28322831
private typingWatchers;
28332832
private readonly cancellationToken;

0 commit comments

Comments
 (0)