diff options
| author | 2026-10-15 10:11:56 +0330 | |
|---|---|---|
| committer | 2026-10-15 10:11:56 +0330 | |
| commit | e1e0a265e931637f452ac05bb7d912e07bcee574 (patch) | |
| tree | 60289bb1fc3d812dfc576f01e0f8a83091a495c1 /editors/vscode/client | |
| parent | analyzer: check borrow returns of forward-called functions at the unit's end;... (diff) | |
lsp: borrow errors ranged on the use, with related information for where the owner ended and was declared; vscode client passes relatedInformation through
Diffstat (limited to 'editors/vscode/client')
| -rw-r--r-- | editors/vscode/client/extension.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/editors/vscode/client/extension.js b/editors/vscode/client/extension.js index cd497d8..38c4c73 100644 --- a/editors/vscode/client/extension.js +++ b/editors/vscode/client/extension.js @@ -207,6 +207,13 @@ function showDiags(uri, raw) { : vscode.DiagnosticSeverity.Error; const diag = new vscode.Diagnostic(new vscode.Range(r.start.line, r.start.character, r.end.line, r.end.character), d.message, sev); diag.source = d.source || 'zc'; + // a borrow error names its owner: where it ended and where it was declared + if (Array.isArray(d.relatedInformation)) { + diag.relatedInformation = d.relatedInformation.filter(ri => ri && ri.location && ri.location.range).map(ri => { + const lr = ri.location.range; + return new vscode.DiagnosticRelatedInformation(new vscode.Location(vscode.Uri.parse(ri.location.uri || uri), new vscode.Range(lr.start.line, lr.start.character, lr.end.line, lr.end.character)), ri.message || ''); + }); + } return diag; }); stats.diagnostics += list.length; |
