Skip to content

Commit 94033f2

Browse files
committed
If project name is specified in compile on save, do not update all projects to just use that project
1 parent 3bfe91c commit 94033f2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/server/session.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,13 +1465,24 @@ namespace ts.server {
14651465
}
14661466

14671467
private getCompileOnSaveAffectedFileList(args: protocol.FileRequestArgs): ReadonlyArray<protocol.CompileOnSaveAffectedFileListSingleProject> {
1468-
const info = this.projectService.getScriptInfoEnsuringProjectsUptoDate(args.file);
1468+
let info: ScriptInfo | undefined;
1469+
let project: Project | undefined;
1470+
if (args.projectFileName) {
1471+
// Do not update all projects if we are looking for specific project to compile on save
1472+
project = this.projectService.findProject(args.projectFileName)!;
1473+
if (project.dirty) project.updateGraph();
1474+
info = this.projectService.getScriptInfo(args.file);
1475+
}
1476+
else {
1477+
info = this.projectService.getScriptInfoEnsuringProjectsUptoDate(args.file);
1478+
}
1479+
14691480
if (!info) {
14701481
return emptyArray;
14711482
}
14721483

14731484
// if specified a project, we only return affected file list in this project
1474-
const projects = args.projectFileName ? [this.projectService.findProject(args.projectFileName)!] : info.containingProjects;
1485+
const projects = args.projectFileName ? [project!] : info.containingProjects;
14751486
const symLinkedProjects = !args.projectFileName && this.projectService.getSymlinkedProjects(info);
14761487
return combineProjectOutput(
14771488
info,

0 commit comments

Comments
 (0)