Add support to ignore certain diagnostics (#46)

Add support to ignore certain diagnostics
This commit is contained in:
Alexandru Dima 2019-12-17 08:55:09 +01:00 committed by GitHub
commit e91b33e295
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View file

@ -181,6 +181,7 @@ export class DiagnosticsAdapter extends Adapter {
} }
const markers = diagnostics const markers = diagnostics
.reduce((p, c) => c.concat(p), []) .reduce((p, c) => c.concat(p), [])
.filter(d => (this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(d.code) === -1)
.map(d => this._convertDiagnostics(resource, d)); .map(d => this._convertDiagnostics(resource, d));
monaco.editor.setModelMarkers(monaco.editor.getModel(resource), this._selector, markers); monaco.editor.setModelMarkers(monaco.editor.getModel(resource), this._selector, markers);

1
src/monaco.d.ts vendored
View file

@ -129,6 +129,7 @@ declare module monaco.languages.typescript {
noSemanticValidation?: boolean; noSemanticValidation?: boolean;
noSyntaxValidation?: boolean; noSyntaxValidation?: boolean;
noSuggestionDiagnostics?: boolean; noSuggestionDiagnostics?: boolean;
diagnosticCodesToIgnore?: number[];
} }
export interface LanguageServiceDefaults { export interface LanguageServiceDefaults {