Skip loading configured project just to report project info through synchronizeProjectList for project opened by external project

This commit is contained in:
Sheetal Nandi 2018-07-25 14:01:48 -07:00
parent 8c4607d8eb
commit f67bdd429a
3 changed files with 12 additions and 5 deletions

View File

@ -149,6 +149,8 @@ namespace ts.server {
*/
private projectStateVersion = 0;
protected isInitialLoadPending: () => boolean = returnFalse;
/*@internal*/
dirty = false;
@ -1033,7 +1035,10 @@ namespace ts.server {
/* @internal */
getChangesSinceVersion(lastKnownVersion?: number): ProjectFilesWithTSDiagnostics {
updateProjectIfDirty(this);
// Update the graph only if initial configured project load is not pending
if (!this.isInitialLoadPending()) {
updateProjectIfDirty(this);
}
const info: protocol.ProjectVersionInfo = {
projectName: this.getProjectName(),
@ -1320,6 +1325,8 @@ namespace ts.server {
/*@internal*/
projectOptions?: ProjectOptions | true;
protected isInitialLoadPending: () => boolean = returnTrue;
/*@internal*/
constructor(configFileName: NormalizedPath,
projectService: ProjectService,
@ -1343,6 +1350,7 @@ namespace ts.server {
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
updateGraph(): boolean {
this.isInitialLoadPending = returnFalse;
const reloadLevel = this.pendingReload;
this.pendingReload = ConfigFileProgramReloadLevel.None;
let result: boolean;

View File

@ -2976,10 +2976,7 @@ namespace ts.projectSystem {
checkNumberOfProjects(projectService, { configuredProjects: 1, externalProjects: 0, inferredProjects: 0 });
const configProject = configuredProjectAt(projectService, 0);
checkProjectActualFiles(configProject, [libFile.path, configFile.path]);
const diagnostics = configProject.getAllProjectErrors();
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);
checkProjectActualFiles(configProject, []); // Since no files opened from this project, its not loaded
host.reloadFS([libFile, site]);
host.checkTimeoutQueueLengthAndRun(1);

View File

@ -8198,6 +8198,7 @@ declare namespace ts.server {
* This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
*/
private projectStateVersion;
protected isInitialLoadPending: () => boolean;
private readonly cancellationToken;
isNonTsProject(): boolean;
isJsOnlyProject(): boolean;
@ -8318,6 +8319,7 @@ declare namespace ts.server {
private externalProjectRefCount;
private projectErrors;
private projectReferences;
protected isInitialLoadPending: () => boolean;
/**
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
* @returns: true if set of files in the project stays the same and false - otherwise.