mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
Fixing false positive ref link being detected
This commit is contained in:
@@ -71,6 +71,16 @@ suite('markdown: find all references', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('Should not return references when on link text', async () => {
|
||||
const doc = new InMemoryDocument(workspacePath('doc.md'), joinLines(
|
||||
`[ref](#abc)`,
|
||||
`[ref]: http://example.com`,
|
||||
));
|
||||
|
||||
const refs = await getReferences(doc, new vscode.Position(0, 1), new InMemoryWorkspaceMarkdownDocuments([doc]));
|
||||
assert.deepStrictEqual(refs, []);
|
||||
});
|
||||
|
||||
test('Should find references using normalized slug', async () => {
|
||||
const doc = new InMemoryDocument(workspacePath('doc.md'), joinLines(
|
||||
`# a B c`,
|
||||
|
||||
@@ -245,4 +245,15 @@ suite('markdown: rename', () => {
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
test('Rename should not be supported on link text', async () => {
|
||||
const uri = workspacePath('doc.md');
|
||||
const doc = new InMemoryDocument(uri, joinLines(
|
||||
`# Header`,
|
||||
`[text](#header)`,
|
||||
));
|
||||
|
||||
await assert.rejects(getRenameRange(doc, new vscode.Position(1, 2), new InMemoryWorkspaceMarkdownDocuments([doc])));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user