Also ignore star checkboxes (#151029)

Fixes #150672

This makes our md link detection also ignore checkboxes like `* [x]` instead of just `- [x]`
This commit is contained in:
Matt Bierner 2022-06-01 14:23:29 -07:00 committed by GitHub
parent 0715386207
commit 9302343e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -357,7 +357,7 @@ export class MdLinkProvider implements vscode.DocumentLinkProvider {
linkStart = document.positionAt(offset);
const line = document.lineAt(linkStart.line);
// See if link looks like a checkbox
const checkboxMatch = line.text.match(/^\s*\-\s*\[x\]/i);
const checkboxMatch = line.text.match(/^\s*[\-\*]\s*\[x\]/i);
if (checkboxMatch && linkStart.character <= checkboxMatch[0].length) {
continue;
}

View file

@ -318,12 +318,15 @@ suite('markdown.DocumentLinkProvider', () => {
const links = await getLinksForFile(joinLines(
'- [x]',
'- [X]',
'- []',
'- [ ]',
'* [x]',
'* [X]',
'* [ ]',
``,
`[x]: http://example.com`
));
assert.strictEqual(links.length, 1);
assertRangeEqual(links[0].range, new vscode.Range(4, 5, 4, 23));
assertRangeEqual(links[0].range, new vscode.Range(7, 5, 7, 23));
});