Skip to content

Commit f67bdd4

Browse files
committed
Skip loading configured project just to report project info through synchronizeProjectList for project opened by external project
1 parent 8c4607d commit f67bdd4

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/server/project.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ namespace ts.server {
149149
*/
150150
private projectStateVersion = 0;
151151

152+
protected isInitialLoadPending: () => boolean = returnFalse;
153+
152154
/*@internal*/
153155
dirty = false;
154156

@@ -1033,7 +1035,10 @@ namespace ts.server {
10331035

10341036
/* @internal */
10351037
getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics {
1036-
updateProjectIfDirty(this);
1038+
// Update the graph only if initial configured project load is not pending
1039+
if (!this.isInitialLoadPending()) {
1040+
updateProjectIfDirty(this);
1041+
}
10371042

10381043
const info: protocol.ProjectVersionInfo = {
10391044
projectName: this.getProjectName(),
@@ -1320,6 +1325,8 @@ namespace ts.server {
13201325
/*@internal*/
13211326
projectOptions?: ProjectOptions | true;
13221327

1328+
protected isInitialLoadPending: () => boolean = returnTrue;
1329+
13231330
/*@internal*/
13241331
constructor(configFileName: NormalizedPath,
13251332
projectService: ProjectService,
@@ -1343,6 +1350,7 @@ namespace ts.server {
13431350
* @returns: true if set of files in the project stays the same and false - otherwise.
13441351
*/
13451352
updateGraph(): boolean {
1353+
this.isInitialLoadPending = returnFalse;
13461354
const reloadLevel = this.pendingReload;
13471355
this.pendingReload = ConfigFileProgramReloadLevel.None;
13481356
let result: boolean;

src/testRunner/unittests/tsserverProjectSystem.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -2976,10 +2976,7 @@ namespace ts.projectSystem {
29762976
checkNumberOfProjects(projectService, { configuredProjects: 1, externalProjects: 0, inferredProjects: 0 });
29772977

29782978
const configProject = configuredProjectAt(projectService, 0);
2979-
checkProjectActualFiles(configProject, [libFile.path, configFile.path]);
2980-
2981-
const diagnostics = configProject.getAllProjectErrors();
2982-
assert.equal(diagnostics[0].code, Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code);
2979+
checkProjectActualFiles(configProject, []); // Since no files opened from this project, its not loaded
29832980

29842981
host.reloadFS([libFile, site]);
29852982
host.checkTimeoutQueueLengthAndRun(1);

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

+2
Original file line numberDiff line numberDiff line change
@@ -8198,6 +8198,7 @@ declare namespace ts.server {
81988198
* This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
81998199
*/
82008200
private projectStateVersion;
8201+
protected isInitialLoadPending: () => boolean;
82018202
private readonly cancellationToken;
82028203
isNonTsProject(): boolean;
82038204
isJsOnlyProject(): boolean;
@@ -8318,6 +8319,7 @@ declare namespace ts.server {
83188319
private externalProjectRefCount;
83198320
private projectErrors;
83208321
private projectReferences;
8322+
protected isInitialLoadPending: () => boolean;
83218323
/**
83228324
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
83238325
* @returns: true if set of files in the project stays the same and false - otherwise.

0 commit comments

Comments
 (0)