Closed chrishuynhc closed 1 year ago
Proposal: Expose a new API, async selectResult(uri: Uri, runIndex: number, resultIndex: number): void
.
Rationale: There is already an internal method, panel.select, that takes in a Result
and opens the editor/line number corresponding to that Result.
A unique Result can be looked up through the three parameters above. Hence, there should be a minimal amount of work required in the extension to enable this scenario.
All in all, the full implementation of the API could look something like this:
function selectResult(uri: Uri, runIndex: number, resultIndex: number): void {
const log = store.logs.find(log => log._uri === uri.toString());
const result = log?.runs[runIndex]?.results?.[resultIndex];
if (!result) return;
panel.select(result);
}
Currently, there is not an exposed extension API that will allow other extensions to open the SARIF viewer to a specific result. This feature would allow our extension to generate static analysis results and open the user directly to issues based on a specified result id.