microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.16k stars 28.54k forks source link

Open local files from comments #187636

Open leahrivkin opened 1 year ago

leahrivkin commented 1 year ago

Currently, the markdown support for comments allows referencing external HTTP links, but not relative/local paths. This is an issue for images (see https://github.com/microsoft/codetour/issues/18) and other files. This feature would be incredibly helpful when creating codetours or other comments for quick navigation.

For example, imagine you have this file tree

| src
| ––– controllers
|        | ––– api.ts
|        | ––– home.ts
│ ––– app.ts
| ––– server.ts

In app.ts leave a comment

Look at this cool file (api.ts)[./controllers/api.ts]

Click on the link and you will see the following error

2023-07-11 12:20:40.221 [error] Error: The editor could not be opened because the file was not found.
    at Eh.bc (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2290:19256)
    at async Eh.setInput (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2290:18343)
    at async e.$Kub.M (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2288:20301)
    at async e.$Kub.D (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2288:18969)
    at async e.$Kub.openEditor (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2288:17957)
    at async vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2473:12434
    at async e.$uvb.G (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1156:82236)
    at async e.$uvb.openCodeEditor (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:702:4560)
    at async g.open (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:627:44144)
    at async e.$Dyb.open (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:627:45282)
    at async a (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:646:3828)

This feature was previously requested https://github.com/microsoft/vscode/issues/93028 but closed due to inactivity. Please consider reopening it!

VSCodeTriageBot commented 1 year ago

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!

VSCodeTriageBot commented 1 year ago

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

VSCodeTriageBot commented 12 months ago

:slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

alexr00 commented 8 months ago

@mjbvz is there a way to tell the markdown renderer to use a specific root for relative paths? I didn't see anything in the markdown renderer options.