Skip to content

Commit a8a1a82

Browse files
committed
set the option when creating inferred projects
1 parent 8648239 commit a8a1a82

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/server/editorServices.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,12 @@ namespace ts.server {
10791079
project,
10801080
fileName => this.onConfigFileAddedForInferredProject(fileName));
10811081

1082+
if (root.scriptKind === ScriptKind.JS || root.scriptKind === ScriptKind.JSX) {
1083+
const options = project.getCompilerOptions();
1084+
options.maxNodeModuleJsDepth = 2;
1085+
project.setCompilerOptions(options);
1086+
}
1087+
10821088
project.updateGraph();
10831089

10841090
if (!useExistingProject) {

src/server/project.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,6 @@ namespace ts.server {
169169
this.compilerOptions.allowNonTsExtensions = true;
170170
}
171171

172-
if (this.projectKind === ProjectKind.Inferred) {
173-
// Add default compiler options for inferred projects here
174-
if (this.compilerOptions.maxNodeModuleJsDepth === undefined) {
175-
this.compilerOptions.maxNodeModuleJsDepth = 2;
176-
}
177-
}
178-
179172
this.setInternalCompilerOptionsForEmittingJsFiles();
180173

181174
this.lsHost = new LSHost(this.projectService.host, this, this.projectService.cancellationToken);

0 commit comments

Comments
 (0)