As I know, the SARIF Viewer only searches the local path from the sarif file root folder, not the workspace folder. It will not work when a sarif view is located as a separated folder from the source code root folder.
I suggest that the path resolve should search from the workspace or vscode windows folder.
Reproduce
Generate a SARIF file from a source by some SAST tools, such as: CodeQL or Semgrep.
It could try to recursive loop through the subfolders of the workspace too. It will be more convenient. Of course, it will cost more resources, this could be set to disable by default anyway.
As I know, the SARIF Viewer only searches the local path from the sarif file root folder, not the workspace folder. It will not work when a sarif view is located as a separated folder from the source code root folder. I suggest that the path resolve should search from the workspace or vscode windows folder.
Reproduce
vscode-folder-root
by VSCodeExpection
SARIF Viewer resolves the relative path from the Vscode dir or workspace folder.