diff --git a/extensions/search-result/src/extension.ts b/extensions/search-result/src/extension.ts index 3abaa97de56..fcc4cbba2d3 100644 --- a/extensions/search-result/src/extension.ts +++ b/extensions/search-result/src/extension.ts @@ -121,9 +121,16 @@ export function activate(context: vscode.ExtensionContext) { function relativePathToUri(path: string, resultsUri: vscode.Uri): vscode.Uri | undefined { - if (pathUtils.isAbsolute(path)) { return vscode.Uri.file(path); } + if (pathUtils.isAbsolute(path)) { + return vscode.Uri + .file(path) + .with({ scheme: process.env.HOME ? 'file' : 'vscode-userdata' }); + } + if (path.indexOf('~/') === 0) { - return vscode.Uri.file(pathUtils.join(process.env.HOME!, path.slice(2))); + return vscode.Uri + .file(pathUtils.join(process.env.HOME ?? '', path.slice(2))) + .with({ scheme: process.env.HOME ? 'file' : 'vscode-userdata' }); } const uriFromFolderWithPath = (folder: vscode.WorkspaceFolder, path: string): vscode.Uri =>