From 1cb8db8a0c45c68a94229d6cdddcf55072c3358a Mon Sep 17 00:00:00 2001 From: Adam Trotta Date: Thu, 31 Aug 2023 18:25:31 -0400 Subject: [PATCH] feat: select finding when opening from problems tab --- .../findingsDiagnosticsProvider.ts | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/diagnostics/findingsDiagnosticsProvider.ts b/src/diagnostics/findingsDiagnosticsProvider.ts index bc835af81..3848236eb 100644 --- a/src/diagnostics/findingsDiagnosticsProvider.ts +++ b/src/diagnostics/findingsDiagnosticsProvider.ts @@ -42,14 +42,21 @@ export default class FindingsDiagnosticsProvider implements vscode.Disposable { findings.map((finding) => { if (!finding.problemLocation) return; - const relatedInformation = finding.appMapUri - ? [ - new vscode.DiagnosticRelatedInformation( - new vscode.Location(finding.appMapUri, new vscode.Position(0, 0)), - 'Open AppMap' - ), - ] - : []; + const relatedInformation = [] as vscode.DiagnosticRelatedInformation[]; + if (finding.appMapUri) { + const uri = finding.appMapUri.with({ + fragment: JSON.stringify({ + selectedObject: `analysis-finding:${finding.finding.hash_v2}`, + }), + }); + + const diagnosticInfo = new vscode.DiagnosticRelatedInformation( + new vscode.Location(uri, new vscode.Position(0, 0)), + 'Open AppMap' + ); + + relatedInformation.push(diagnosticInfo); + } const problemUri = finding.problemLocation.uri; updatedProblemUriStrings.add(problemUri.toString());