mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 02:30:15 -06:00
address cr feedback
This commit is contained in:
parent
bf5faa04a6
commit
09fc3b3a18
@ -3067,12 +3067,15 @@ namespace ts.projectSystem {
|
||||
const projectService = createProjectService(host);
|
||||
projectService.openClientFile(file1.path);
|
||||
|
||||
const project = projectService.inferredProjects[0];
|
||||
const sourceFileForFile1 = project.getSourceFile(<Path>file1.path);
|
||||
const sourceFileForModuleFile = project.getSourceFile(<Path>moduleFile.path);
|
||||
let project = projectService.inferredProjects[0];
|
||||
let options = project.getCompilerOptions();
|
||||
assert.isTrue(options.maxNodeModuleJsDepth === 2);
|
||||
|
||||
assert.isNotNull(sourceFileForFile1);
|
||||
assert.isNotNull(sourceFileForModuleFile);
|
||||
// Assert the option sticks
|
||||
projectService.setCompilerOptionsForInferredProjects({ target: ScriptTarget.ES2016 });
|
||||
project = projectService.inferredProjects[0];
|
||||
options = project.getCompilerOptions();
|
||||
assert.isTrue(options.maxNodeModuleJsDepth === 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user