Repository: microsoft/vscode (TypeScript) — Feature

Issue:
exclude "<" and ">" from file path detection
<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->

Exclude both `<` at the start and `>` at the end from filepath detection.

See this screenshot.

<img width="2560" alt="Screenshot 2023-03-25 at 15 01 58" src="https://user-images.githubusercontent.com/7969166/227733949-3966a634-a9c1-4e28-85dd-3f8cf822ed8f.png">

The file path is detected but includes the surrounding angle brackets. Doing a `Ctrl+click` to go to the file causes it to not be found. If one removes the angle brackets from the search manually, then it finds the file.



Discussion:
This actually works fine for me:

![image](https://user-images.githubusercontent.com/2193314/228026926-a615ce3f-7b0d-4978-92ab-578192c808f3.png)

Is nakata/main.go relative to the current working directory?
Weird... 🤔
No. The actual file I want to go is at `./cmd/nakama/main.go` but it was compiled as `nakama`, so my logger used the compiled name as base path.

I'm using latest version of vscode (1.76.2) and the integrated terminal is running zsh, on macOS. Looks like the difference is that you are running on Windows Powershell.


Can you try using the Insiders build here? https://code.visualstudio.com/insiders
Sure. Just for completeness, even if I pass the actual relative path, it doesn't work. See the screenshot (still using stable).
<img width="2560" alt="Screenshot 2023-03-27 at 16 17 20" src="https://user-images.githubusercontent.com/7969166/228044247-82073c76-567d-4e54-8994-407004a42b39.png">


Tested with insider and same behaviour.

```
Version: 1.77.0-insider (Universal)
Commit: b9226e1ccc11625bcb42b55efb795e07ee533bb0
Date: 2023-03-24T18:44:58.328Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin arm64 22.3.0
Sandboxed: Yes
```

<img width="2560" alt="Screenshot 2023-03-27 at 16 21 08" src="https://user-images.githubusercontent.com/7969166/228045071-8eb9aef3-30fc-4dcd-8ea7-f6d403b168c3.png">

Can repro on macOS 👍 

<img width="226" alt="Screenshot 2023-03-27 at 12 58 16 pm" src="https://user-images.githubusercontent.com/2193314/228052692-e7e512a6-86e6-4fad-9663-5a66d24c44b8.png">


Resolving patch:
diff --git a/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts b/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts
--- a/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts
+++ b/src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts
@@ -279,8 +279,8 @@ enum RegexPathConstants {
 	PathSeparatorClause = '\\/',
 	// '":; are allowed in paths but they are often separators so ignore them
 	// Also disallow \\ to prevent a catastropic backtracking case #24795
-	ExcludedPathCharactersClause = '[^\\0\\s!`&*()\'":;\\\\]',
-	ExcludedStartPathCharactersClause = '[^\\0\\s!`&*()\\[\\]\'":;\\\\]',
+	ExcludedPathCharactersClause = '[^\\0<>\\s!`&*()\'":;\\\\]',
+	ExcludedStartPathCharactersClause = '[^\\0<>\\s!`&*()\\[\\]\'":;\\\\]',
 
 	WinOtherPathPrefix = '\\.\\.?|\\~',
 	WinPathSeparatorClause = '(?:\\\\|\\/)',


Test patch:
diff --git a/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts b/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts
--- a/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts
+++ b/src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts
@@ -15,6 +15,22 @@ interface ITestLink {
 	hasCol: boolean;
 }
 
+const operatingSystems: ReadonlyArray<OperatingSystem> = [
+	OperatingSystem.Linux,
+	OperatingSystem.Macintosh,
+	OperatingSystem.Windows
+];
+const osTestPath: { [key: number | OperatingSystem]: string } = {
+	[OperatingSystem.Linux]: '/test/path/linux',
+	[OperatingSystem.Macintosh]: '/test/path/macintosh',
+	[OperatingSystem.Windows]: 'C:\\test\\path\\windows'
+};
+const osLabel: { [key: number | OperatingSystem]: string } = {
+	[OperatingSystem.Linux]: '[Linux]',
+	[OperatingSystem.Macintosh]: '[macOS]',
+	[OperatingSystem.Windows]: '[Windows]'
+};
+
 const testRow = 339;
 const testCol = 12;
 const testLinks: ITestLink[] = [
@@ -375,76 +391,78 @@ suite('TerminalLinkParsing', () => {
 		});
 
 		suite('"<>"', () => {
-			test('should exclude bracket characters from link paths', () => {
-				deepStrictEqual(
-					detectLinks('<C:\\Github\\microsoft\\vscode<', OperatingSystem.Windows),
-					[
-						{
-							path: {
-								index: 1,
-								text: 'C:\\Github\\microsoft\\vscode'
-							},
-							prefix: undefined,
-							suffix: undefined
-						}
-					] as IParsedLink[]
-				);
-				deepStrictEqual(
-					detectLinks('>C:\\Github\\microsoft\\vscode>', OperatingSystem.Windows),
-					[
-						{
-							path: {
-								index: 1,
-								text: 'C:\\Github\\microsoft\\vscode'
-							},
-							prefix: undefined,
-							suffix: undefined
-						}
-					] as IParsedLink[]
-				);
-			});
-			test('should exclude bracket characters from link paths with suffixes', () => {
-				deepStrictEqual(
-					detectLinks('<C:\\Github\\microsoft\\vscode:400<', OperatingSystem.Windows),
-					[
-						{
-							path: {
-								index: 1,
-								text: 'C:\\Github\\microsoft\\vscode'
-							},
-							prefix: undefined,
-							suffix: {
-								col: undefined,
-								row: 400,
+			for (const os of operatingSystems) {
+				test(`should exclude bracket characters from link paths ${osLabel[os]}`, () => {
+					deepStrictEqual(
+						detectLinks(`<${osTestPath[os]}<`, os),
+						[
+							{
+								path: {
+									index: 1,
+									text: osTestPath[os]
+								},
+								prefix: undefined,
+								suffix: undefined
+							}
+						] as IParsedLink[]
+					);
+					deepStrictEqual(
+						detectLinks(`>${osTestPath[os]}>`, os),
+						[
+							{
+								path: {
+									index: 1,
+									text: osTestPath[os]
+								},
+								prefix: undefined,
+								suffix: undefined
+							}
+						] as IParsedLink[]
+					);
+				});
+				test(`should exclude bracket characters from link paths with suffixes ${osLabel[os]}`, () => {
+					deepStrictEqual(
+						detectLinks(`<${osTestPath[os]}:400<`, os),
+						[
+							{
+								path: {
+									index: 1,
+									text: osTestPath[os]
+								},
+								prefix: undefined,
 								suffix: {
-									index: 27,
-									text: ':400'
+									col: undefined,
+									row: 400,
+									suffix: {
+										index: 1 + osTestPath[os].length,
+										text: ':400'
+									}
 								}
 							}
-						}
-					] as IParsedLink[]
-				);
-				deepStrictEqual(
-					detectLinks('>C:\\Github\\microsoft\\vscode:400>', OperatingSystem.Windows),
-					[
-						{
-							path: {
-								index: 1,
-								text: 'C:\\Github\\microsoft\\vscode'
-							},
-							prefix: undefined,
-							suffix: {
-								col: undefined,
-								row: 400,
+						] as IParsedLink[]
+					);
+					deepStrictEqual(
+						detectLinks(`>${osTestPath[os]}:400>`, os),
+						[
+							{
+								path: {
+									index: 1,
+									text: osTestPath[os]
+								},
+								prefix: undefined,
 								suffix: {
-									index: 27,
-									text: ':400'
+									col: undefined,
+									row: 400,
+									suffix: {
+										index: 1 + osTestPath[os].length,
+										text: ':400'
+									}
 								}
 							}
-						}
-					] as IParsedLink[]
-				);
-			});
+						] as IParsedLink[]
+					);
+				});
+			}
 		});
 
 		suite('should detect file names in git diffs', () => {