address cr feedback

This commit is contained in:
zhengbli
2016-12-29 10:26:34 -08:00
parent bf5faa04a6
commit 09fc3b3a18
3 changed files with 15 additions and 12 deletions

View File

@@ -1073,7 +1073,7 @@ namespace ts.server {
: new InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects);
if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) {
project.isJsInferredProject = true;
project.setAsJsInferredProject();
}
project.addRoot(root);

View File

@@ -713,14 +713,14 @@ namespace ts.server {
})();
private _isJsInferredProject = false;
set isJsInferredProject(newValue: boolean) {
if (newValue && !this._isJsInferredProject) {
this.setCompilerOptions(this.getCompilerOptions());
}
this._isJsInferredProject = newValue;
setAsJsInferredProject() {
this._isJsInferredProject = true;
this.setCompilerOptions();
}
setCompilerOptions(newOptions: CompilerOptions) {
setCompilerOptions(newOptions?: CompilerOptions) {
newOptions = newOptions ? newOptions : this.getCompilerOptions();
if (!newOptions) {
return;
}