Repository: microsoft/vscode (TypeScript) — Feature

Issue:
Support GNU style file:line.column links
The [Sail compiler]() outputs file:line links that follow [this GNU convention](https://www.gnu.org/prep/standards/html_node/Errors.html):

```
Warning: Redundant case sail-riscv/model/riscv_sys_control.sail:206.6-7:
206 |      _ => false
    |      ^
```

This doesn't currently work in VSCode. It does support a very wide range of formats and I don't recall ever seeing this format before (even from GNU tools) so I suspect nobody else uses it. Nonetheless it's easy to add support in VSCode.

See https://github.com/rems-project/sail/issues/287


Discussion:
Doesn't seem to work, see `echo src/vs/workbench/contrib/snippets/browser/snippetsFile.ts:70.30-36`

<img width="825" alt="Screenshot 2023-08-29 at 14 41 05" src="https://github.com/microsoft/vscode/assets/1794099/e659e1a2-69b9-4e3c-8687-123fc4e0fbf9">

The PR intentionally left that out:

> so I've opted for the simpler option of just ignoring the - part.

But it should be easy to add so will leave this open.

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
@@ -63,9 +63,11 @@ function generateLinkSuffixRegex(eolOnly: boolean) {
 
 	// The comments in the regex below use real strings/numbers for better readability, here's
 	// the legend:
-	// - Path = foo
-	// - Row  = 339
-	// - Col  = 12
+	// - Path    = foo
+	// - Row     = 339
+	// - Col     = 12
+	// - RowEnd  = 341
+	// - ColEnd  = 14
 	//
 	// These all support single quote ' in the place of " and [] in the place of ()
 	const lineAndColumnRegexClauses = [
@@ -78,7 +80,9 @@ function generateLinkSuffixRegex(eolOnly: boolean) {
 		// "foo",339
 		// "foo",339:12
 		// "foo",339.12
-		`(?::| |['"],)${r()}([:.]${c()})?` + eolSuffix,
+		// "foo",339.12-14
+		// "foo",339.12-341.14
+		`(?::| |['"],)${r()}([:.]${c()}(?:-(?:${re()}\.)?${ce()})?)?` + eolSuffix,
 		// The quotes below are optional          [#171652]
 		// "foo", line 339                        [#40468]
 		// "foo", line 339, col 12


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
@@ -47,6 +47,8 @@ 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.12-14', prefix: undefined, suffix: ' 339.12-14', hasRow: true, hasCol: true, hasRowEnd: false, hasColEnd: true },
+	{ link: 'foo 339.12-341.14', prefix: undefined, suffix: ' 339.12-341.14', hasRow: true, hasCol: true, hasRowEnd: true, hasColEnd: true },
 
 	// Double quotes
 	{ link: '"foo",339', prefix: '"', suffix: '",339', hasRow: true, hasCol: false },