-
Notifications
You must be signed in to change notification settings - Fork 707
Closed
Description
This issue is similar to #1813, but not a duplicate.
- Extension version: 0.19.0
- VSCode Version: 1.48.1
- OS: Windows_NT x64 10.0.19041
Steps to Reproduce:
- Hover over
// GH-2085, blah blah. - Result: no hover card 😿
- Hover over
// Test GH-2085. - Result: no hover card 😿
The regex mentioned in #1813 currently considers ($|[\s\:\;\-\(\=\)]) after an issue number:
vscode-pull-request-github/src/issues/util.ts
Lines 19 to 20 in 6da2af3
| export const ISSUE_EXPRESSION = /(([^\s]+)\/([^\s]+))?(#|GH-)([1-9][0-9]*)($|[\s\:\;\-\(\=\)])/; | |
| export const ISSUE_OR_URL_EXPRESSION = /(https?:\/\/github\.com\/(([^\s]+)\/([^\s]+))\/([^\s]+\/)?(issues|pull)\/([0-9]+)(#issuecomment\-([0-9]+))?)|(([^\s]+)\/([^\s]+))?(#|GH-)([1-9][0-9]*)($|[\s\:\;\-\(\=\)])/; |
Extending this to include , and . would be nice, but (as mentioned in #1813 (comment) ) it really seems like this should simply be looking for a word boundary with \b. That would allow hover cards to activate for comments like // Is this GH-2085?, // Avoid the problem mentioned in GH-2085!, /***Test GH-2085***/, etc.
As an aside, most characters in character classes lose their specialness and don't need to be escaped; r1 and r2 behave identically:
const r1 = /[\s\:\;\-\(\=\)]/;
const r2 = /[\s:;\-(=)]/;
for (const c of [' ', ':', ';', '-', '(', '=', ')', 'x']) {
console.log(`'${c}': ${r1.test(c) === r2.test(c)}`);
}