File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ,
You can’t perform that action at this time.
0 commit comments