Skip to content

Commit

Permalink
Skip refreshing configured project on change of config file if its no…
Browse files Browse the repository at this point in the history
…t loaded
  • Loading branch information
sheetalkamat committed Sep 5, 2019
1 parent 82126fb commit ea2bb85
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,8 @@ namespace ts.server {
}
else {
this.logConfigFileWatchUpdate(project.getConfigFilePath(), project.canonicalConfigFilePath, configFileExistenceInfo, ConfigFileWatcherStatus.ReloadingInferredRootFiles);
// Skip refresh if project is not yet loaded
if (project.isInitialLoadPending()) return;
project.pendingReload = ConfigFileProgramReloadLevel.Full;
project.pendingReloadReason = "Change in config file detected";
this.delayUpdateProjectGraph(project);
Expand Down
8 changes: 4 additions & 4 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,9 +1137,8 @@ namespace ts.server {
}

filesToString(writeProjectFileNames: boolean) {
if (!this.program) {
return "\tFiles (0)\n";
}
if (this.isInitialLoadPending()) return "\tFiles (0) InitialLoadPending\n";
if (!this.program) return "\tFiles (0) NoProgram\n";
const sourceFiles = this.program.getSourceFiles();
let strBuilder = `\tFiles (${sourceFiles.length})\n`;
if (writeProjectFileNames) {
Expand Down Expand Up @@ -1516,7 +1515,8 @@ namespace ts.server {
/*@internal*/
projectOptions?: ProjectOptions | true;

protected isInitialLoadPending: () => boolean = returnTrue;
/*@internal*/
isInitialLoadPending: () => boolean = returnTrue;

/*@internal*/
sendLoadingProjectFinish = false;
Expand Down
1 change: 0 additions & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8575,7 +8575,6 @@ declare namespace ts.server {
private externalProjectRefCount;
private projectErrors;
private projectReferences;
protected isInitialLoadPending: () => boolean;
fileExists(file: string): boolean;
directoryExists(path: string): boolean;
/**
Expand Down

0 comments on commit ea2bb85

Please sign in to comment.