Repository: microsoft/vscode (TypeScript)
Date: 2023-01-19 12:30:00+00:00
Task type: Bug Fix

Issue:
when a file is not wrapped in quotes, link line/col detection don't work
1. miss a semicolon somewhere in your changes
2. `git add . && git commit`
3. try to click on the link to go to the line with a problem

https://user-images.githubusercontent.com/29464607/213260508-eef0d6cc-7f18-4173-9bdd-84473bfae807.mov





Issue discussion:
It's happening because only the column number is being detected as the link suffix;

![image](https://user-images.githubusercontent.com/2193314/213441755-b0118a6e-4f97-4fea-8d00-08f28f446518.png)


Solution patch:
diff --git a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkParsing.ts b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkParsing.ts
--- a/src/vs/workbench/contrib/terminal/browser/links/terminalLinkParsing.ts
+++ b/src/vs/workbench/contrib/terminal/browser/links/terminalLinkParsing.ts
@@ -29,11 +29,12 @@ const linkSuffixRegex = new Lazy<RegExp>(() => {
 		// foo:339
 		// foo:339:12
 		// foo 339
-		// foo 339:12                   [#140780]
+		// foo 339:12                    [#140780]
 		// "foo",339
 		// "foo",339:12
 		`(?::| |['"],)${l()}(:${c()})?$`,
-		// "foo", line 339               [#40468]
+		// The quotes below are optional [#171652]
+		// "foo", line 339                [#40468]
 		// "foo", line 339, col 12
 		// "foo", line 339, column 12
 		// "foo":line 339
@@ -45,7 +46,7 @@ const linkSuffixRegex = new Lazy<RegExp>(() => {
 		// "foo" on line 339
 		// "foo" on line 339, col 12
 		// "foo" on line 339, column 12
-		`['"](?:, |: ?| on )line ${l()}(, col(?:umn)? ${c()})?$`,
+		`['"]?(?:, |: ?| on )line ${l()}(, col(?:umn)? ${c()})?$`,
 		// foo(339)
 		// foo(339,12)
 		// foo(339, 12)


Test patch:
diff --git a/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkParsing.test.ts b/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkParsing.test.ts
--- a/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkParsing.test.ts
+++ b/src/vs/workbench/contrib/terminal/test/browser/links/terminalLinkParsing.test.ts
@@ -55,6 +55,20 @@ const testLinks: ITestLink[] = [
 	{ link: '\'foo\' on line 339, col 12', suffix: '\' on line 339, col 12', hasRow: true, hasCol: true },
 	{ link: '\'foo\' on line 339, column 12', suffix: '\' on line 339, column 12', hasRow: true, hasCol: true },
 
+	// No quotes
+	{ link: 'foo, line 339', suffix: ', line 339', hasRow: true, hasCol: false },
+	{ link: 'foo, line 339, col 12', suffix: ', line 339, col 12', hasRow: true, hasCol: true },
+	{ link: 'foo, line 339, column 12', suffix: ', line 339, column 12', hasRow: true, hasCol: true },
+	{ link: 'foo:line 339', suffix: ':line 339', hasRow: true, hasCol: false },
+	{ link: 'foo:line 339, col 12', suffix: ':line 339, col 12', hasRow: true, hasCol: true },
+	{ link: 'foo:line 339, column 12', suffix: ':line 339, column 12', hasRow: true, hasCol: true },
+	{ link: 'foo: line 339', suffix: ': line 339', hasRow: true, hasCol: false },
+	{ link: 'foo: line 339, col 12', suffix: ': line 339, col 12', hasRow: true, hasCol: true },
+	{ link: 'foo: line 339, column 12', suffix: ': line 339, column 12', hasRow: true, hasCol: true },
+	{ link: 'foo on line 339', suffix: ' on line 339', hasRow: true, hasCol: false },
+	{ link: 'foo on line 339, col 12', suffix: ' on line 339, col 12', hasRow: true, hasCol: true },
+	{ link: 'foo on line 339, column 12', suffix: ' on line 339, column 12', hasRow: true, hasCol: true },
+
 	// Parentheses
 	{ link: 'foo(339)', suffix: '(339)', hasRow: true, hasCol: false },
 	{ link: 'foo(339,12)', suffix: '(339,12)', hasRow: true, hasCol: true },