What should I do to show lint bugs from Biome in the Monaco Editor? #5101
Replies: 1 comment
-
Answer `
` |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of the row or column information is missing in the result from Linter
function setBiomeErrors(editor: monaco.editor.IStandaloneCodeEditor, biomeDiagnostics: any) {
const model = editor.getModel();
if (!model) return;
const markers: monaco.editor.IMarkerData[] = biomeDiagnostics.diagnostics.map((diag: any) => ({
startLineNumber: diag.location.span[0] + 1,
startColumn: diag.location.range.start.column + 1,
endLineNumber: diag.location.span[1] + 1,
endColumn: diag.location.range.end.column + 1,
message: diag.message,
severity: diag.severity === "error" ? monaco.MarkerSeverity.Error : monaco.MarkerSeverity.Warning
}));
monaco.editor.setModelMarkers(model, "biome", markers);
}
{ "category": "lint/correctness/noUnusedVariables", "severity": "warning", "description": "This variable is unused.", "message": [ { "elements": [], "content": "This variable is unused." } ], "advices": { "advices": [ { "log": [ "info", [ { "elements": [], "content": "Unused variables usually are result of incomplete refactoring, typos and other source of bugs." } ] ] }, { "log": [ "info", [ { "elements": [], "content": "Unsafe fix: If this is intentional, prepend " }, { "elements": [ "Emphasis" ], "content": "arrow" }, { "elements": [], "content": " with an underscore." } ] ] }, { "diff": { "dictionary": "const arrow_arrow = () => {\n ass\n asdsa\n}", "ops": [ { "diffOp": { "equal": { "range": [ 0, 6 ] } } }, { "diffOp": { "delete": { "range": [ 6, 11 ] } } }, { "diffOp": { "insert": { "range": [ 11, 17 ] } } }, { "diffOp": { "equal": { "range": [ 17, 18 ] } } }, { "diffOp": { "equal": { "range": [ 18, 47 ] } } } ] } } ] }, "verbose_advices": { "advices": [] }, "location": { "path": { "file": "global script.js" }, "span": [ 6, 11 ], "source_code": null }, "tags": [ "fixable" ], "source": null }
Country
Beta Was this translation helpful? Give feedback.
All reactions