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:
parent
d14183c5a1
commit
2ca9953235
|
@ -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);
|
||||
|
||||
|
|
2
src/server/protocol.d.ts
vendored
2
src/server/protocol.d.ts
vendored
|
@ -709,7 +709,7 @@ declare namespace ts.server.protocol {
|
|||
}
|
||||
|
||||
export interface SetCompilerOptionsForInferredProjectsArgs {
|
||||
options: CompilerOptions;
|
||||
options: ExternalProjectCompilerOptions;
|
||||
}
|
||||
|
||||
export interface SetCompilerOptionsForInferredProjectsRequest extends Request {
|
||||
|
|
Loading…
Reference in a new issue