Repository: microsoft/vscode (TypeScript)
Date: 2023-02-07 20:01:17+00:00
Task type: Bug Fix

Issue:
Terminal doesn't detect line/column in Kotlin error message
Type: <b>Bug</b>

The Kotlin compiler produces error messages like this:
```
e: /home/ericeil/src/Foo.kt: (245, 5): A 'return' expression required in a function with a block body ('{...}')
```

I am virtually certain the VS Code terminal used to bring me to the line and column of the error when I clicked on these error messages, but now it does not.  I did not update any terminal config, so I assume this was due to a VS code update.   This has slowed my workflow considerably.

VS Code version: Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:23:45.584Z)
OS version: Windows_NT x64 10.0.22623
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.15.83.1-microsoft-standard-WSL2

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz (8 x 3302)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.84GB (7.73GB free)|
|Process Argv|--crash-reporter-id 0a310bd2-e3f8-472f-b0ad-955022cb6cfd|
|Screen Reader|no|
|VM|0%|

|Item|Value|
|---|---|
|Remote|WSL: Ubuntu|
|OS|Linux x64 5.15.83.1-microsoft-standard-WSL2|
|CPUs|11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz (8 x 3302)|
|Memory (System)|23.47GB (15.42GB free)|
|VM|0%|
</details><details><summary>Extensions (46)</summary>

Extension|Author (truncated)|Version
---|---|---
evmspecforvscode|Cer|0.0.3
codespaces|Git|1.13.7
remote-wsl|ms-|0.75.1
cup|mwe|1.0.0
github-markdown-preview|bie|0.3.0
markdown-checkbox|bie|0.4.0
markdown-emoji|bie|0.3.0
markdown-footnotes|bie|0.1.1
markdown-mermaid|bie|1.17.4
markdown-preview-github-styles|bie|1.0.1
markdown-yaml-preamble|bie|0.1.0
evmspec-lsp|Cer|0.1.12
evmspecforvscode|Cer|0.0.3
vscode-certora-prover|Cer|0.1.2
circleci|Cir|1.6.3
gitignore|cod|0.9.0
vscode-markdownlint|Dav|0.49.0
gitlens|eam|13.2.0
EditorConfig|Edi|0.16.4
code-runner|for|0.12.0
kotlin|fwc|0.2.26
vscode-pull-request-github|Git|0.58.0
solidity|Jua|0.0.141
Kotlin|mat|1.7.1
git-graph|mhu|1.30.0
jvm-bytecode-viewer|mnx|0.3.1
isort|ms-|2022.8.0
python|ms-|2023.2.0
vscode-pylance|ms-|2023.2.10
sarif-viewer|MS-|3.3.5
gradle-language|nac|0.2.3
open-html-in-browser|pea|2.1.10
java|red|1.14.0
vscode-gradle-extension-pack|ric|0.0.4
rust-analyzer|rus|0.3.1394
kotlin-on-vscode|set|0.0.1
git-merger|sha|0.4.1
intellicode-api-usage-examples|Vis|0.2.7
vscodeintellicode|Vis|1.2.30
vscode-gradle|vsc|3.12.6
vscode-java-debug|vsc|0.48.0
vscode-java-pack|vsc|0.25.7
vscode-java-test|vsc|0.37.2023013002
vscode-maven|vsc|0.40.4
jar-viewer|wma|1.2.0
vscode-open-in-github|ziy|1.3.6


</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1:30587005
2e4cg342:30602488
pyind779:30657576
f6dab269:30613381
pythonsymbol12cf:30657549

```

</details>

<!-- generated by issue reporter -->


Issue discussion:
I don't think we ever supported the `path: (line, col)` format, though it might have accidentally works with the `path (line, col)` format. We can add this 👍 

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
@@ -75,9 +75,10 @@ const linkSuffixRegexEol = new Lazy<RegExp>(() => {
 		// foo(339,12)
 		// foo(339, 12)
 		// foo (339)
-		// foo (339,12)
-		// foo (339, 12)
-		` ?[\\[\\(]${l()}(?:, ?${c()})?[\\]\\)]$`,
+		//   ...
+		// foo: (339)
+		//   ...
+		`:? ?[\\[\\(]${l()}(?:, ?${c()})?[\\]\\)]$`,
 	];
 
 	const suffixClause = lineAndColumnRegexClauses
@@ -125,9 +126,10 @@ const linkSuffixRegex = new Lazy<RegExp>(() => {
 		// foo(339,12)
 		// foo(339, 12)
 		// foo (339)
-		// foo (339,12)
-		// foo (339, 12)
-		` ?[\\[\\(]${l()}(?:, ?${c()})?[\\]\\)]`,
+		//   ...
+		// foo: (339)
+		//   ...
+		`:? ?[\\[\\(]${l()}(?:, ?${c()})?[\\]\\)]`,
 	];
 
 	const suffixClause = lineAndColumnRegexClauses


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
@@ -78,6 +78,9 @@ const testLinks: ITestLink[] = [
 	{ link: 'foo (339)', prefix: undefined, suffix: ' (339)', hasRow: true, hasCol: false },
 	{ link: 'foo (339,12)', prefix: undefined, suffix: ' (339,12)', hasRow: true, hasCol: true },
 	{ link: 'foo (339, 12)', prefix: undefined, suffix: ' (339, 12)', hasRow: true, hasCol: true },
+	{ link: 'foo: (339)', prefix: undefined, suffix: ': (339)', hasRow: true, hasCol: false },
+	{ link: 'foo: (339,12)', prefix: undefined, suffix: ': (339,12)', hasRow: true, hasCol: true },
+	{ link: 'foo: (339, 12)', prefix: undefined, suffix: ': (339, 12)', hasRow: true, hasCol: true },
 
 	// Square brackets
 	{ link: 'foo[339]', prefix: undefined, suffix: '[339]', hasRow: true, hasCol: false },
@@ -86,6 +89,9 @@ const testLinks: ITestLink[] = [
 	{ link: 'foo [339]', prefix: undefined, suffix: ' [339]', hasRow: true, hasCol: false },
 	{ link: 'foo [339,12]', prefix: undefined, suffix: ' [339,12]', hasRow: true, hasCol: true },
 	{ link: 'foo [339, 12]', prefix: undefined, suffix: ' [339, 12]', hasRow: true, hasCol: true },
+	{ link: 'foo: [339]', prefix: undefined, suffix: ': [339]', hasRow: true, hasCol: false },
+	{ link: 'foo: [339,12]', prefix: undefined, suffix: ': [339,12]', hasRow: true, hasCol: true },
+	{ link: 'foo: [339, 12]', prefix: undefined, suffix: ': [339, 12]', hasRow: true, hasCol: true },
 
 	// Non-breaking space
 	{ link: 'foo\u00A0339:12', prefix: undefined, suffix: '\u00A0339:12', hasRow: true, hasCol: true },
diff --git a/src/vs/workbench/contrib/terminal/test/browser/links/terminalLocalLinkDetector.test.ts b/src/vs/workbench/contrib/terminal/test/browser/links/terminalLocalLinkDetector.test.ts
--- a/src/vs/workbench/contrib/terminal/test/browser/links/terminalLocalLinkDetector.test.ts
+++ b/src/vs/workbench/contrib/terminal/test/browser/links/terminalLocalLinkDetector.test.ts
@@ -94,8 +94,10 @@ const supportedLinkFormats: LinkFormatInfo[] = [
 	{ urlFormat: '{0} ({1})', line: '5' },
 	{ urlFormat: '{0}({1},{2})', line: '5', column: '3' },
 	{ urlFormat: '{0} ({1},{2})', line: '5', column: '3' },
+	{ urlFormat: '{0}: ({1},{2})', line: '5', column: '3' },
 	{ urlFormat: '{0}({1}, {2})', line: '5', column: '3' },
 	{ urlFormat: '{0} ({1}, {2})', line: '5', column: '3' },
+	{ urlFormat: '{0}: ({1}, {2})', line: '5', column: '3' },
 	{ urlFormat: '{0}:{1}', line: '5' },
 	{ urlFormat: '{0}:{1}:{2}', line: '5', column: '3' },
 	{ urlFormat: '{0} {1}:{2}', line: '5', column: '3' },
@@ -103,8 +105,10 @@ const supportedLinkFormats: LinkFormatInfo[] = [
 	{ urlFormat: '{0} [{1}]', line: '5' },
 	{ urlFormat: '{0}[{1},{2}]', line: '5', column: '3' },
 	{ urlFormat: '{0} [{1},{2}]', line: '5', column: '3' },
+	{ urlFormat: '{0}: [{1},{2}]', line: '5', column: '3' },
 	{ urlFormat: '{0}[{1}, {2}]', line: '5', column: '3' },
 	{ urlFormat: '{0} [{1}, {2}]', line: '5', column: '3' },
+	{ urlFormat: '{0}: [{1}, {2}]', line: '5', column: '3' },
 	{ urlFormat: '{0}",{1}', line: '5' },
 	{ urlFormat: '{0}\',{1}', line: '5' }
 ];