Skip to content

Commit 8bd8ed7

Browse files
author
zhengbli
committed
Tolerate non-existing files specified
1 parent bc6d6ea commit 8bd8ed7

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/server/editorServices.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,8 +1122,13 @@ namespace ts.server {
11221122
return { configFileName, configFileErrors: configResult.errors };
11231123
}
11241124
else {
1125+
// even if opening config file was successful, it could still
1126+
// contain errors that were tolerated.
11251127
this.log("Opened configuration file " + configFileName, "Info");
11261128
this.configuredProjects.push(configResult.project);
1129+
if (configResult.errors && configResult.errors.length > 0) {
1130+
return { configFileName, configFileErrors: configResult.errors };
1131+
}
11271132
}
11281133
}
11291134
else {
@@ -1261,14 +1266,14 @@ namespace ts.server {
12611266
}
12621267
else {
12631268
const project = this.createProject(configFilename, projectOptions);
1269+
const errors: Diagnostic[] = [];
12641270
for (const rootFilename of projectOptions.files) {
12651271
if (this.host.fileExists(rootFilename)) {
12661272
const info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename);
12671273
project.addRoot(info);
12681274
}
12691275
else {
1270-
const error = createCompilerDiagnostic(Diagnostics.File_0_not_found, rootFilename);
1271-
return { success: false, errors: [error] };
1276+
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, rootFilename));
12721277
}
12731278
}
12741279
project.finishGraph();
@@ -1279,7 +1284,7 @@ namespace ts.server {
12791284
path => this.directoryWatchedForSourceFilesChanged(project, path),
12801285
/*recursive*/ true
12811286
);
1282-
return { success: true, project: project };
1287+
return { success: true, project: project, errors };
12831288
}
12841289
}
12851290

0 commit comments

Comments
 (0)