Skip to content

Commit 0ff160f

Browse files
committed
Add files to change set instead of delay reloading project on "change" command
1 parent 54f64a1 commit 0ff160f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/server/editorServices.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,12 +1948,7 @@ namespace ts.server {
19481948
const change = file.changes[i];
19491949
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
19501950
}
1951-
if (!this.changedFiles) {
1952-
this.changedFiles = [scriptInfo];
1953-
}
1954-
else if (!contains(this.changedFiles, scriptInfo)) {
1955-
this.changedFiles.push(scriptInfo);
1956-
}
1951+
this.addChangedFile(scriptInfo);
19571952
}
19581953
}
19591954

@@ -1969,6 +1964,16 @@ namespace ts.server {
19691964
}
19701965
}
19711966

1967+
/* @internal */
1968+
addChangedFile(scriptInfo: ScriptInfo) {
1969+
if (!this.changedFiles) {
1970+
this.changedFiles = [scriptInfo];
1971+
}
1972+
else if (!contains(this.changedFiles, scriptInfo)) {
1973+
this.changedFiles.push(scriptInfo);
1974+
}
1975+
}
1976+
19721977
private closeConfiguredProject(configFile: NormalizedPath): void {
19731978
const configuredProject = this.findConfiguredProjectByProjectName(configFile);
19741979
if (configuredProject && configuredProject.deleteOpenRef() === 0) {

src/server/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,9 +1287,9 @@ namespace ts.server {
12871287
const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
12881288
if (start >= 0) {
12891289
scriptInfo.editContent(start, end, args.insertString);
1290+
this.projectService.addChangedFile(scriptInfo);
12901291
this.changeSeq++;
12911292
}
1292-
this.projectService.delayUpdateProjectGraphAndInferredProjectsRefresh(project);
12931293
}
12941294
}
12951295

0 commit comments

Comments
 (0)