microsoft / vscode

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

File links containing "[" and "]" don't work in terminal #161543

Closed alex-statsig closed 1 year ago

alex-statsig commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. echo a link in terminal containing "[" or "]" characters (ex. echo /Users/alex/dev/statsig/console/pages/[company_id]/dashboards/[dashboard].tsx)
  2. Try to cmd+click the link, observe that it is split on those characters. For example, /Users/alex/dev/statsig/console/pages/[company_id]/dashboards/[dashboard].tsx links to /Users/alex/dev/statsig/console/pages/, company_id, /dashboards/, dashboard, and .tsx. In reality this is one valid path (nextjs uses "[ ]" to identify parameters in URLs) Screen Shot 2022-09-22 at 5 12 00 PM
Tyriar commented 1 year ago

This works for urls:

Image

Not local paths:

Image

Tyriar commented 1 year ago

https://github.com/microsoft/vscode/issues/161521 reported that it does (kind of) work:

image

We would need to review all link detectors for this.

Tyriar commented 1 year ago

This happens with local links because [] are currently excluded chars:

https://github.com/microsoft/vscode/blob/78b2df948783c6094571635088ac625bbf73aaba/src/vs/workbench/contrib/terminal/browser/links/terminalLocalLinkDetector.ts#L39-L42