Skip to content

Support to detect file links in output #149153

Open

Description

@juxeii

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:

  1. Open a workspace folder, say /home/juxeii/projects/myproject
  2. Create an empyt file, say gtestLog_testfoo and save this under /home/juxeii/projects/myproject and under /home/juxeii
  3. 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:
grafik
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

  1. newspore commented on May 25, 2022

    @newspore

    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:16950

    So 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://relativePath

  2. added
    output
    remote
    on May 27, 2022
  3. bpasero commented on May 27, 2022

    @bpasero
    Contributor

    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 file link that gets written to from a remote should result in a vscode-remote link for opening?

  4. juxeii commented on May 27, 2022

    @juxeii
    Author

    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.

  5. bpasero commented on May 27, 2022

    @bpasero
    Contributor

    I wonder if something with the paths is messed up, when you click "Create File" where does it store the file to?

  6. removed
    remote
    on May 27, 2022
  7. 31 remaining items

  8. added
    feature-request
    on May 31, 2022
  9. changed the title [-]Cannot open file outside workspace in output window with ctrl-click[/-] [+]Support to detect file links in output[/+] on May 31, 2022
  10. added
    remote
    on May 31, 2022
  11. bpasero commented on May 31, 2022

    @bpasero
    Contributor

    Turning into a feature as this works as intended currently. We need to expand the output link detection to handle file links if we want to support this scenario.

  12. vscodenpa commented on May 31, 2022

    @vscodenpa

    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!

  13. juxeii commented on May 31, 2022

    @juxeii
    Author

    Turning into a feature as this works as intended currently. We need to expand the output link detection to handle file links if we want to support this scenario.

    Is there any reason why it should not be supported? At least a little documentation about this behaviour would be needed.

  14. bpasero commented on May 31, 2022

    @bpasero
    Contributor

    Is there any reason why it should not be supported?

    Nope, no reason I can think of.

  15. juxeii commented on May 31, 2022

    @juxeii
    Author

    Just asking, since it is declared as feature now, which means it is dependant on upvotes.

  16. bpasero commented on May 31, 2022

    @bpasero
    Contributor

    👍

  17. juxeii commented on May 31, 2022

    @juxeii
    Author

    👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestoutputremote

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions