Add files to change set instead of delay reloading project on "change" command

This commit is contained in:
Sheetal Nandi 2017-09-05 19:36:32 -07:00
parent 54f64a1695
commit 0ff160f93f
2 changed files with 12 additions and 7 deletions

View File

@ -1948,12 +1948,7 @@ namespace ts.server {
const change = file.changes[i];
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
}
if (!this.changedFiles) {
this.changedFiles = [scriptInfo];
}
else if (!contains(this.changedFiles, scriptInfo)) {
this.changedFiles.push(scriptInfo);
}
this.addChangedFile(scriptInfo);
}
}
@ -1969,6 +1964,16 @@ namespace ts.server {
}
}
/* @internal */
addChangedFile(scriptInfo: ScriptInfo) {
if (!this.changedFiles) {
this.changedFiles = [scriptInfo];
}
else if (!contains(this.changedFiles, scriptInfo)) {
this.changedFiles.push(scriptInfo);
}
}
private closeConfiguredProject(configFile: NormalizedPath): void {
const configuredProject = this.findConfiguredProjectByProjectName(configFile);
if (configuredProject && configuredProject.deleteOpenRef() === 0) {

View File

@ -1287,9 +1287,9 @@ namespace ts.server {
const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
if (start >= 0) {
scriptInfo.editContent(start, end, args.insertString);
this.projectService.addChangedFile(scriptInfo);
this.changeSeq++;
}
this.projectService.delayUpdateProjectGraphAndInferredProjectsRefresh(project);
}
}