Repository navigation
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.67.0 (system setup)
- OS Version: Windows_NT x64 10.0.19044
Steps to Reproduce:
- Open a workspace folder, say
/home/juxeii/projects/myproject - Create an empyt file, say
gtestLog_testfooand save this under/home/juxeii/projects/myprojectand under/home/juxeii - Create a simple vsc extension and write both file paths to an output channel like so:
const outputChannel = vscode.window.createOutputChannel('MyExt');
const testfileuriBad = vscode.Uri.file(path.join('/home/juxeii', 'gtestLog_testfoo'));
outputChannel.appendLine(testfileuriBad);
const testfileuriGood = vscode.Uri.file(path.join('/home/juxeii/projects/myproject, 'gtestLog_testfoo'));
outputChannel.appendLine(testfileuriGood);
On my extension it looks like this
[5/10/2022, 12:57:31] INFO: Log file: file:///home/juxeii/projects/myproject/gtestLog_testfoo
[5/10/2022, 12:57:31] INFO: Test file file:///home/juxeii/gtestLog_testfoo
The output channel provides two file link, both of which I can click.
But only the first link file:///home/juxeii/projects/myproject/gtestLog_testfoo opens the file, while the second fails:

This occurs both when working with remote ssh on wsl2 on windows, and with a remote linux machine.
Is this intended behavior not letting open files outside the workspace?
The error log in the output window gives Log (Window)
[2022-05-10 13:21:40.864] [renderer3] [error] Error: File not found
at g.handleSetInputError (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2701:95592)
at async g.setInput (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2701:94832)
at async doSetInput (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2699:6429)
at async doOpenEditor (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2699:4791)
at async d.openEditor (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2699:3783)
at async vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2906:16950
at async C.doOpenCodeEditor (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:1360:31342)
at async m.open (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:594:51701)
at async open (vscode-file://vscode-app/c:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:594:53162)
EDIT: open the folder /home/juxeii as workspace root, and I can open the file again. This confirmes that somehow the workspace root is in play here, which has a problem with links in the output window to files outside the workspace.
Activity
newspore commentedon May 25, 2022
I actually have the Same problem but this is also Happening when the Problems try to Redirect to the Editor.
It display a "The editor could not be Opened because the File was not Found" Error.
When Checking the Logs:
[2022-05-25 14:26:36.240] [renderer1] [error] Error: File not found at g.handleSetInputError (vscode-file://vscode-app/c:/Users/lgarcia/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2701:95592) at async g.setInput (vscode-file://vscode-app/c:/Users/lgarcia/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2701:94832) at async doSetInput (vscode-file://vscode-app/c:/Users/lgarcia/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2699:6429) at async doOpenEditor (vscode-file://vscode-app/c:/Users/lgarcia/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2699:4791) at async d.openEditor (vscode-file://vscode-app/c:/Users/lgarcia/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2699:3783) at async vscode-file://vscode-app/c:/Users/lgarcia/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2906:16950So I do have a Workspace with only 1 Folder and the Extension I use are for Saleforce Extension Pack.
Now doing some debugging I did also find that the Folder that is being Tryied to Display Stores on the VS Root Folder rather than taking the Relative Path within the Workspace.
Openning in File Explorer command does also crash and cannot actually show or display the File in question and when I follow the Suggestion of Created a new File it did show me that the file was created on
C://relativePathbpasero commentedon May 27, 2022
Does this reproduce when not using remote? I wonder if we need to properly convert file paths for opening when clicking on the output because they originate from the remote and cannot be opened locally. I.e. a
filelink that gets written to from a remote should result in avscode-remotelink for opening?juxeii commentedon May 27, 2022
Benjamin Pasero (@bpasero) Yes, it is not dependent on any remote setting. Just create an simple extension with an output channel and write two uri's to it. One within project root and one outside.
bpasero commentedon May 27, 2022
I wonder if something with the paths is messed up, when you click "Create File" where does it store the file to?
31 remaining items
[-]Cannot open file outside workspace in output window with ctrl-click[/-][+]Support to detect file links in output[/+]bpasero commentedon May 31, 2022
Turning into a feature as this works as intended currently. We need to expand the output link detection to handle
filelinks if we want to support this scenario.vscodenpa commentedon May 31, 2022
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
juxeii commentedon May 31, 2022
Is there any reason why it should not be supported? At least a little documentation about this behaviour would be needed.
bpasero commentedon May 31, 2022
Nope, no reason I can think of.
juxeii commentedon May 31, 2022
Just asking, since it is declared as feature now, which means it is dependant on upvotes.
bpasero commentedon May 31, 2022
👍
juxeii commentedon May 31, 2022
👍