diff --git a/packages/foam-vscode/src/core/model/workspace.ts b/packages/foam-vscode/src/core/model/workspace.ts index 3081d670f..495f859f6 100644 --- a/packages/foam-vscode/src/core/model/workspace.ts +++ b/packages/foam-vscode/src/core/model/workspace.ts @@ -87,11 +87,8 @@ export class FoamWorkspace implements IDisposable { const resources: Resource[] = []; - this._resources.find(needle).forEach(elm => { - if (elm[0].indexOf(getExtension(normalize(identifier))) > 0) { - resources.push(elm[1]); - } - }); + this._resources.find(needle).forEach(elm => resources.push(elm[1])); + if (mdNeedle) { this._resources.find(mdNeedle).forEach(elm => resources.push(elm[1])); } diff --git a/packages/foam-vscode/src/features/navigation-provider.spec.ts b/packages/foam-vscode/src/features/navigation-provider.spec.ts index c03a14b1c..407434b68 100644 --- a/packages/foam-vscode/src/features/navigation-provider.spec.ts +++ b/packages/foam-vscode/src/features/navigation-provider.spec.ts @@ -231,6 +231,10 @@ describe('Document navigation', () => { doc, new vscode.Position(0, 26) ); + + // Make sure the references are sorted by position, so we match the right expectation + refs.sort((a, b) => a.range.start.character - b.range.start.character); + expect(refs.length).toEqual(2); expect(refs[0]).toEqual({ uri: toVsCodeUri(fileB.uri),