Skip to content

Commit ba25f9c

Browse files
authored
Fix PowerShell terminal link detection for paths with spaces (microsoft#254504)
1 parent 34d2ec4 commit ba25f9c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/vs/workbench/contrib/terminalContrib/links/browser/terminalLocalLinkDetector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const fallbackMatchers: RegExp[] = [
5252
// C:\foo/bar baz:339: error ...
5353
// C:\foo/bar baz:339:12: error ... [#178584, Clang]
5454
/^(?<link>(?<path>.+):(?<line>\d+)(?::(?<col>\d+))?) ?:/,
55-
// Cmd prompt
56-
/^(?<link>(?<path>.+))>/,
55+
// PowerShell and cmd prompt
56+
/^(?:PS\s+)?(?<link>(?<path>[^>]+))>/,
5757
// The whole line is the path
5858
/^ *(?<link>(?<path>.+))/
5959
];

src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLocalLinkDetector.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ const supportedFallbackLinkFormats: LinkFormatInfo[] = [
158158
{ urlFormat: '{0}:{1}:{2} :', line: '5', column: '3', linkCellEndOffset: -2 },
159159
{ urlFormat: '{0}:{1}:', line: '5', linkCellEndOffset: -1 },
160160
{ urlFormat: '{0}:{1}:{2}:', line: '5', column: '3', linkCellEndOffset: -1 },
161+
// PowerShell prompt
162+
{ urlFormat: 'PS {0}>', linkCellStartOffset: 3, linkCellEndOffset: -1 },
161163
// Cmd prompt
162164
{ urlFormat: '{0}>', linkCellEndOffset: -1 },
163165
// The whole line is the path

0 commit comments

Comments
 (0)