mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
Fix finding references from link without header ref
This commit is contained in:
@@ -215,7 +215,7 @@ suite('markdown references', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('Should find references from link across files when triggered on link without file extension ', async () => {
|
||||
test('Should find references from link across files when triggered on link without file extension', async () => {
|
||||
const docUri = workspaceFile('doc.md');
|
||||
const other1Uri = workspaceFile('sub', 'other.md');
|
||||
|
||||
@@ -250,4 +250,41 @@ suite('markdown references', () => {
|
||||
assert.deepStrictEqual(ref.range.start.line, 1);
|
||||
}
|
||||
});
|
||||
|
||||
test('Should include header references when triggered on file link', async () => {
|
||||
const docUri = workspaceFile('doc.md');
|
||||
const otherUri = workspaceFile('sub', 'other.md');
|
||||
|
||||
const doc = new InMemoryDocument(docUri, joinLines(
|
||||
`[with ext](./sub/other)`,
|
||||
`[with ext](./sub/other#header)`,
|
||||
`[without ext](./sub/other.md#no-such-header)`,
|
||||
));
|
||||
const refs = await getReferences(doc, new vscode.Position(0, 15), new InMemoryWorkspaceMarkdownDocuments([
|
||||
doc,
|
||||
new InMemoryDocument(otherUri, joinLines(
|
||||
`pre`,
|
||||
`# header`, // Definition should not be included since we triggered on a file link
|
||||
`post`,
|
||||
)),
|
||||
]));
|
||||
|
||||
assert.deepStrictEqual(refs!.length, 3);
|
||||
|
||||
{
|
||||
const ref = refs![0];
|
||||
assert.deepStrictEqual(ref.uri.toString(), docUri.toString());
|
||||
assert.deepStrictEqual(ref.range.start.line, 0);
|
||||
}
|
||||
{
|
||||
const ref = refs![1];
|
||||
assert.deepStrictEqual(ref.uri.toString(), docUri.toString());
|
||||
assert.deepStrictEqual(ref.range.start.line, 1);
|
||||
}
|
||||
{
|
||||
const ref = refs![2];
|
||||
assert.deepStrictEqual(ref.uri.toString(), docUri.toString());
|
||||
assert.deepStrictEqual(ref.range.start.line, 2);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user