Tolerate non-existing files specified
This commit is contained in:
parent
bc6d6ea49a
commit
8bd8ed7d4b
|
@ -1122,8 +1122,13 @@ namespace ts.server {
|
||||||
return { configFileName, configFileErrors: configResult.errors };
|
return { configFileName, configFileErrors: configResult.errors };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// even if opening config file was successful, it could still
|
||||||
|
// contain errors that were tolerated.
|
||||||
this.log("Opened configuration file " + configFileName, "Info");
|
this.log("Opened configuration file " + configFileName, "Info");
|
||||||
this.configuredProjects.push(configResult.project);
|
this.configuredProjects.push(configResult.project);
|
||||||
|
if (configResult.errors && configResult.errors.length > 0) {
|
||||||
|
return { configFileName, configFileErrors: configResult.errors };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1261,14 +1266,14 @@ namespace ts.server {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const project = this.createProject(configFilename, projectOptions);
|
const project = this.createProject(configFilename, projectOptions);
|
||||||
|
const errors: Diagnostic[] = [];
|
||||||
for (const rootFilename of projectOptions.files) {
|
for (const rootFilename of projectOptions.files) {
|
||||||
if (this.host.fileExists(rootFilename)) {
|
if (this.host.fileExists(rootFilename)) {
|
||||||
const info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename);
|
const info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename);
|
||||||
project.addRoot(info);
|
project.addRoot(info);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const error = createCompilerDiagnostic(Diagnostics.File_0_not_found, rootFilename);
|
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, rootFilename));
|
||||||
return { success: false, errors: [error] };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
project.finishGraph();
|
project.finishGraph();
|
||||||
|
@ -1279,7 +1284,7 @@ namespace ts.server {
|
||||||
path => this.directoryWatchedForSourceFilesChanged(project, path),
|
path => this.directoryWatchedForSourceFilesChanged(project, path),
|
||||||
/*recursive*/ true
|
/*recursive*/ true
|
||||||
);
|
);
|
||||||
return { success: true, project: project };
|
return { success: true, project: project, errors };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue