Support compile on save for inferred projects (#10847)

* Support compile on save for inferred projects

* Rename to remove the "VS" prefix
This commit is contained in:
Zhengbo Li 2016-09-13 16:14:55 -07:00 committed by GitHub
parent d14183c5a1
commit 2ca9953235
2 changed files with 8 additions and 5 deletions

View file

@ -170,6 +170,7 @@ namespace ts.server {
readonly openFiles: ScriptInfo[] = [];
private compilerOptionsForInferredProjects: CompilerOptions;
private compileOnSaveForInferredProjects: boolean;
private readonly directoryWatchers: DirectoryWatchers;
private readonly throttledOperations: ThrottledOperations;
@ -228,10 +229,12 @@ namespace ts.server {
}
}
setCompilerOptionsForInferredProjects(compilerOptions: CompilerOptions): void {
this.compilerOptionsForInferredProjects = compilerOptions;
setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.ExternalProjectCompilerOptions): void {
this.compilerOptionsForInferredProjects = projectCompilerOptions;
this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave;
for (const proj of this.inferredProjects) {
proj.setCompilerOptions(compilerOptions);
proj.setCompilerOptions(projectCompilerOptions);
proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave;
}
this.updateProjectGraphs(this.inferredProjects);
}
@ -920,7 +923,7 @@ namespace ts.server {
const useExistingProject = this.useSingleInferredProject && this.inferredProjects.length;
const project = useExistingProject
? this.inferredProjects[0]
: new InferredProject(this, this.documentRegistry, /*languageServiceEnabled*/ true, this.compilerOptionsForInferredProjects, /*compileOnSaveEnabled*/ false);
: new InferredProject(this, this.documentRegistry, /*languageServiceEnabled*/ true, this.compilerOptionsForInferredProjects, /*compileOnSaveEnabled*/ this.compileOnSaveForInferredProjects);
project.addRoot(root);

View file

@ -709,7 +709,7 @@ declare namespace ts.server.protocol {
}
export interface SetCompilerOptionsForInferredProjectsArgs {
options: CompilerOptions;
options: ExternalProjectCompilerOptions;
}
export interface SetCompilerOptionsForInferredProjectsRequest extends Request {