Only remove actual schema resolution errors from JSON errors

This commit is contained in:
Literallie 2018-10-09 02:12:01 +02:00
parent 0137ebd471
commit ab43e947f7
No known key found for this signature in database
GPG key ID: 7BE463C902ED152C

View file

@ -92,14 +92,15 @@ export function activate(context: ExtensionContext) {
didChangeConfiguration: () => client.sendNotification(DidChangeConfigurationNotification.type, { settings: getSettings() })
},
handleDiagnostics: (uri: Uri, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => {
let schemaResolveDiagnostic = diagnostics
.find(candidate => candidate.code === ErrorCode.SchemaResolveError);
if (schemaResolveDiagnostic) {
const schemaErrorIndex = diagnostics
.findIndex(candidate => candidate.code === ErrorCode.SchemaResolveError);
if (schemaErrorIndex !== -1) {
// Show schema resolution errors in status bar only; ref: #51032
const schemaResolveDiagnostic = diagnostics[schemaErrorIndex];
window.showWarningMessage(schemaResolveDiagnostic.message);
} else {
next(uri, diagnostics);
diagnostics.splice(schemaErrorIndex, 1);
}
next(uri, diagnostics);
}
}
};