Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkParsing: Support "foo line 123" #175906

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ const linkSuffixRegexEol = 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()})?$`,
// "foo" line 339 column 12
`['"]?(?:,? |: ?| on )line ${l()}(,? col(?:umn)? ${c()})?$`,
// foo(339)
// foo(339,12)
// foo(339, 12)
Expand Down Expand Up @@ -121,7 +122,8 @@ 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()})?`,
// "foo" line 339 column 12
`['"]?(?:,? |: ?| 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 @@ -40,6 +40,8 @@ const testLinks: ITestLink[] = [
{ link: '"foo" on line 339', prefix: '"', suffix: '" on line 339', hasRow: true, hasCol: false },
{ link: '"foo" on line 339, col 12', prefix: '"', suffix: '" on line 339, col 12', hasRow: true, hasCol: true },
{ link: '"foo" on line 339, column 12', prefix: '"', suffix: '" on line 339, column 12', hasRow: true, hasCol: true },
{ link: '"foo" line 339', prefix: '"', suffix: '" line 339', hasRow: true, hasCol: false },
{ link: '"foo" line 339 column 12', prefix: '"', suffix: '" line 339 column 12', hasRow: true, hasCol: true },

// Single quotes
{ link: '\'foo\',339', prefix: '\'', suffix: '\',339', hasRow: true, hasCol: false },
Expand All @@ -56,6 +58,8 @@ const testLinks: ITestLink[] = [
{ link: '\'foo\' on line 339', prefix: '\'', suffix: '\' on line 339', hasRow: true, hasCol: false },
{ link: '\'foo\' on line 339, col 12', prefix: '\'', suffix: '\' on line 339, col 12', hasRow: true, hasCol: true },
{ link: '\'foo\' on line 339, column 12', prefix: '\'', suffix: '\' on line 339, column 12', hasRow: true, hasCol: true },
{ link: '\'foo\' line 339', prefix: '\'', suffix: '\' line 339', hasRow: true, hasCol: false },
{ link: '\'foo\' line 339 column 12', prefix: '\'', suffix: '\' line 339 column 12', hasRow: true, hasCol: true },

// No quotes
{ link: 'foo, line 339', prefix: undefined, suffix: ', line 339', hasRow: true, hasCol: false },
Expand All @@ -70,6 +74,8 @@ const testLinks: ITestLink[] = [
{ link: 'foo on line 339', prefix: undefined, suffix: ' on line 339', hasRow: true, hasCol: false },
{ link: 'foo on line 339, col 12', prefix: undefined, suffix: ' on line 339, col 12', hasRow: true, hasCol: true },
{ link: 'foo on line 339, column 12', prefix: undefined, suffix: ' on line 339, column 12', hasRow: true, hasCol: true },
{ link: 'foo line 339', prefix: undefined, suffix: ' line 339', hasRow: true, hasCol: false },
{ link: 'foo line 339 column 12', prefix: undefined, suffix: ' line 339 column 12', hasRow: true, hasCol: true },

// Parentheses
{ link: 'foo(339)', prefix: undefined, suffix: '(339)', hasRow: true, hasCol: false },
Expand Down