aboutsummaryrefslogtreecommitdiff
path: root/editors/vscode/client
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 10:11:56 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 10:11:56 +0330
commite1e0a265e931637f452ac05bb7d912e07bcee574 (patch)
tree60289bb1fc3d812dfc576f01e0f8a83091a495c1 /editors/vscode/client
parentanalyzer: 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.js7
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;