Skip to content

Commit

Permalink
Set up warning and error diagnostics better
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRalphson committed Feb 18, 2020
1 parent 895fb97 commit 0d5d3ea
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ function validate(lint, resolve) {
dc.delete(editor.document.uri);
const diagnostics = [];
let range; // TODO
diagnostics.push(new vscode.Diagnostic(range, ex.message, vscode.DiagnosticSeverity.Error));
let error = new vscode.Diagnostic(range, ex.message, vscode.DiagnosticSeverity.Error);
error.source = 'openapi-lint';
diagnostics.push(error);
for (let warning of options.warnings||[]) {
diagnostics.push(new vscode.Diagnostic(range, warning.message + ' ' + warning.ruleName, vscode.DiagnosticSeverity.Warning));
let warn = new vscode.Diagnostic(range, warning.message, vscode.DiagnosticSeverity.Warning);
warn.source = 'openapi-lint';
warn.code = warning.ruleName
diagnostics.push(warn);
}
dc.set(editor.document.uri, diagnostics);
});
Expand Down

0 comments on commit 0d5d3ea

Please sign in to comment.