Suppress semantic errors in JS only configured projects

This commit is contained in:
Bill Ticehurst 2017-03-21 14:49:20 -07:00
parent d89553f63e
commit 4ee8bdb762

View file

@ -25,15 +25,14 @@ namespace ts.server {
return ((1e9 * seconds) + nanoseconds) / 1000000.0;
}
function shouldSkipSematicCheck(project: Project) {
if (project.getCompilerOptions().skipLibCheck !== undefined) {
return false;
function shouldSkipSemanticCheck(project: Project) {
if (project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) {
return project.isJsOnlyProject();
}
if ((project.projectKind === ProjectKind.Inferred || project.projectKind === ProjectKind.External) && project.isJsOnlyProject()) {
return true;
else {
// For configured projects, require that skipLibCheck be set also
return project.getCompilerOptions().skipLibCheck && project.isJsOnlyProject();
}
return false;
}
interface FileStart {
@ -454,7 +453,7 @@ namespace ts.server {
private semanticCheck(file: NormalizedPath, project: Project) {
try {
let diags: Diagnostic[] = [];
if (!shouldSkipSematicCheck(project)) {
if (!shouldSkipSemanticCheck(project)) {
diags = project.getLanguageService().getSemanticDiagnostics(file);
}
@ -562,7 +561,7 @@ namespace ts.server {
private getDiagnosticsWorker(args: protocol.FileRequestArgs, isSemantic: boolean, selector: (project: Project, file: string) => Diagnostic[], includeLinePosition: boolean) {
const { project, file } = this.getFileAndProject(args);
if (isSemantic && shouldSkipSematicCheck(project)) {
if (isSemantic && shouldSkipSemanticCheck(project)) {
return [];
}
const scriptInfo = project.getScriptInfoForNormalizedPath(file);