Skip to content

Commit

Permalink
Merge pull request #171719 from microsoft/tyriar/171652
Browse files Browse the repository at this point in the history
Support quote link formats when quotes aren't present
  • Loading branch information
Tyriar committed Jan 19, 2023
2 parents 1761143 + b97fd7c commit 50d8328
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit 50d8328

Please sign in to comment.