Skip to content

Dont open composite projects to determine if script info is part of project #59688

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 11 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make initialLoadPending as property instead of method
  • Loading branch information
sheetalkamat committed Sep 12, 2024
commit 8ad73bd30e0f6eb632b34f8e2cc88856ffd9540a
16 changes: 8 additions & 8 deletions src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ function forEachAncestorProject<T>(
while (true) {
// Skip if project is not composite and we are only looking for solution
if (
!project.isInitialLoadPending() &&
!project.initialLoadPending &&
(
!project.getCompilerOptions().composite ||
project.getCompilerOptions().disableSolutionSearching
Expand Down Expand Up @@ -746,7 +746,7 @@ function forEachAncestorProject<T>(

// If this ancestor is new and was delay loaded, then set the project as potential project reference
if (
ancestor.project.isInitialLoadPending() &&
ancestor.project.initialLoadPending &&
project.getCompilerOptions().composite
) {
// Set a potential project reference
Expand Down Expand Up @@ -909,7 +909,7 @@ function forEachAnyProjectReferenceKind<T>(
): T | undefined {
return project.getCurrentProgram() ?
project.forEachResolvedProjectReference(cb) :
project.isInitialLoadPending() ?
project.initialLoadPending ?
forEachPotentialProjectReference(project, cbPotentialProjectRef) :
forEach(project.getProjectReferences(), cbProjectRef);
}
Expand Down Expand Up @@ -1978,7 +1978,7 @@ export class ProjectService {
scheduledAnyProjectUpdate = true;
if (projectCanonicalPath === canonicalConfigFilePath) {
// Skip refresh if project is not yet loaded
if (project.isInitialLoadPending()) return;
if (project.initialLoadPending) return;
project.pendingUpdateLevel = ProgramUpdateLevel.Full;
project.pendingUpdateReason = loadReason;
this.delayUpdateProjectGraph(project);
Expand Down Expand Up @@ -2056,7 +2056,7 @@ export class ProjectService {

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

Expand Down Expand Up @@ -3895,7 +3895,7 @@ export class ProjectService {
const reason = `Reloading configured project in external project: ${externalProjectName}`;
projects.forEach(project => {
if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) {
if (!project.isInitialLoadPending()) {
if (!project.initialLoadPending) {
this.clearSemanticCache(project);
project.pendingUpdateLevel = ProgramUpdateLevel.Full;
project.pendingUpdateReason = reloadReason(reason);
Expand Down Expand Up @@ -4358,7 +4358,7 @@ export class ProjectService {
/** @internal */
loadAncestorProjectTree(forProjects?: ReadonlyCollection<string>) {
forProjects ??= new Set(
mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : undefined),
mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.initialLoadPending ? key : undefined),
);

const seenProjects = new Set<NormalizedPath>();
Expand Down
14 changes: 7 additions & 7 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ import {
ResolvedTypeReferenceDirectiveWithFailedLookupLocations,
resolvePackageNameToPackageJson,
returnFalse,
returnTrue,
ScriptKind,
some,
sortAndDeduplicate,
Expand Down Expand Up @@ -435,7 +434,8 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo

protected projectErrors: Diagnostic[] | undefined;

protected isInitialLoadPending: () => boolean = returnFalse;
/** @internal */
initialLoadPending = false;

/** @internal */
dirty = false;
Expand Down Expand Up @@ -1911,7 +1911,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
}

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

// Update the graph only if initial configured project load is not pending
if (!this.isInitialLoadPending()) {
if (!this.initialLoadPending) {
updateProjectIfDirty(this);
}

Expand Down Expand Up @@ -2882,7 +2882,7 @@ export class ConfiguredProject extends Project {
projectOptions?: ProjectOptions | true;

/** @internal */
override isInitialLoadPending: () => boolean = returnTrue;
override initialLoadPending = true;

/** @internal */
sendLoadingProjectFinish = false;
Expand Down Expand Up @@ -2972,7 +2972,7 @@ export class ConfiguredProject extends Project {
override updateGraph(): boolean {
if (this.deferredClose) return false;
const isDirty = this.dirty;
this.isInitialLoadPending = returnFalse;
this.initialLoadPending = false;
const updateLevel = this.pendingUpdateLevel;
this.pendingUpdateLevel = ProgramUpdateLevel.Update;
let result: boolean;
Expand Down Expand Up @@ -3032,7 +3032,7 @@ export class ConfiguredProject extends Project {

/** @internal */
setPotentialProjectReference(canonicalConfigPath: NormalizedPath) {
Debug.assert(this.isInitialLoadPending());
Debug.assert(this.initialLoadPending);
(this.potentialProjectReferences || (this.potentialProjectReferences = new Set())).add(canonicalConfigPath);
}

Expand Down
1 change: 0 additions & 1 deletion tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,6 @@ declare namespace ts {
private lastReportedFileNames;
private lastReportedVersion;
protected projectErrors: Diagnostic[] | undefined;
protected isInitialLoadPending: () => boolean;
private typingsCache;
private typingWatchers;
private readonly cancellationToken;
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy