Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Bierner <matb@microsoft.com>2022-06-02 00:23:29 +0300
committerGitHub <noreply@github.com>2022-06-02 00:23:29 +0300
commit9302343e8ea109371a6568ae7310c271943f5bd3 (patch)
tree18b0f4f7a6643b0b5d45666aece974826b496d8c /extensions
parent0715386207cb69967d895ff1738a43b86b87d8d2 (diff)
Also ignore star checkboxes (#151029)
Fixes #150672 This makes our md link detection also ignore checkboxes like `* [x]` instead of just `- [x]`
Diffstat (limited to 'extensions')
-rw-r--r--extensions/markdown-language-features/src/languageFeatures/documentLinkProvider.ts2
-rw-r--r--extensions/markdown-language-features/src/test/documentLinkProvider.test.ts7
2 files changed, 6 insertions, 3 deletions
diff --git a/extensions/markdown-language-features/src/languageFeatures/documentLinkProvider.ts b/extensions/markdown-language-features/src/languageFeatures/documentLinkProvider.ts
index 650a4356f5c..156db7de13e 100644
--- a/extensions/markdown-language-features/src/languageFeatures/documentLinkProvider.ts
+++ b/extensions/markdown-language-features/src/languageFeatures/documentLinkProvider.ts
@@ -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;
}
diff --git a/extensions/markdown-language-features/src/test/documentLinkProvider.test.ts b/extensions/markdown-language-features/src/test/documentLinkProvider.test.ts
index b0f7b18cdd7..48306e7620d 100644
--- a/extensions/markdown-language-features/src/test/documentLinkProvider.test.ts
+++ b/extensions/markdown-language-features/src/test/documentLinkProvider.test.ts
@@ -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));
});