How to write a clickable link in VS Code terminal that points to a multiline range?

26 Views Asked by At

I want to design a program that can output a clickable path to terminal, but I can't find a way to represent a clickable path with a range.

Is there anyone who knows the answer?

Version: 1.87.2 (Universal)
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:21:31.043Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin arm64 23.3.0
  • When I write ./file:1:2-3:4, the range is recognized as a position ln 4.
  • When I write ./file:1:2:3:4, it's recognized as a position ln 3 col 4.
  • When I write ./file:1-3:2-4, I'll get a no matching results after I click it.
1

There are 1 best solutions below

0
starball On

There's a list of supported formats in terminalLinkParsing at the definition of lineAndColumnRegexClauses.

At the time of this writing, among the supported formats, I see

  • foo:339:12-789
  • foo:339:12-341.789
  • "foo",339.12-789
  • "foo",339.12-341.789
  • "foo", lines 339-341
  • "foo", lines 339-341, characters 12-789

See also How does VS Code recognize URLs in text (strings)?.