mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 09:08:53 +01:00
Fix refs to own file being included in md ref results from other file
For #146277
This commit is contained in:
@@ -244,12 +244,33 @@ suite('markdown: find all references', () => {
|
||||
]));
|
||||
|
||||
assertReferencesEqual(refs!,
|
||||
{ uri: docUri, line: 0 }, // Header definition
|
||||
{ uri: docUri, line: 0 },
|
||||
{ uri: docUri, line: 1 },
|
||||
{ uri: docUri, line: 2 },
|
||||
);
|
||||
});
|
||||
|
||||
test('Should not include refs from other file to own header', async () => {
|
||||
const docUri = workspacePath('doc.md');
|
||||
const otherUri = workspacePath('sub', 'other.md');
|
||||
|
||||
const doc = new InMemoryDocument(docUri, joinLines(
|
||||
`[other](./sub/other)`,
|
||||
));
|
||||
|
||||
const refs = await getReferences(doc, new vscode.Position(0, 15), new InMemoryWorkspaceMarkdownDocuments([
|
||||
doc,
|
||||
new InMemoryDocument(otherUri, joinLines(
|
||||
`# header`, // Definition should not be included since we triggered on a file link
|
||||
`[text](#header)`, // Definition should not be included since we triggered on a file link
|
||||
)),
|
||||
]));
|
||||
|
||||
assertReferencesEqual(refs!,
|
||||
{ uri: docUri, line: 0 },
|
||||
);
|
||||
});
|
||||
|
||||
suite('Reference links', () => {
|
||||
test('Should find reference links within file', async () => {
|
||||
const docUri = workspacePath('doc.md');
|
||||
|
||||
Reference in New Issue
Block a user