mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
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:
parent
0715386207
commit
9302343e8e
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue