diff --git a/src/features/chat/application/composer/suggestions.ts b/src/features/chat/application/composer/suggestions.ts index ae8bd385..cc2beba4 100644 --- a/src/features/chat/application/composer/suggestions.ts +++ b/src/features/chat/application/composer/suggestions.ts @@ -132,7 +132,7 @@ function activeContextReferenceSuggestions( const query = rawQuery.toLowerCase(); const start = beforeCursor.length - rawQuery.length - 1; const suggestions: ComposerSuggestion[] = []; - if (references?.activeNote && "active".startsWith(query)) { + if (references?.activeNote && activeNoteContextReferenceQueryMatches(query)) { suggestions.push({ display: "Active file", detail: references.activeNote.path, @@ -153,6 +153,10 @@ function activeContextReferenceSuggestions( return suggestions.slice(0, 8); } +function activeNoteContextReferenceQueryMatches(query: string): boolean { + return ["active", "active-note"].some((alias) => alias.startsWith(query)); +} + export function applyComposerSuggestionInsertion( value: string, cursor: number, diff --git a/tests/features/chat/application/composer/suggestions.test.ts b/tests/features/chat/application/composer/suggestions.test.ts index d1f4d93c..4697dd29 100644 --- a/tests/features/chat/application/composer/suggestions.test.ts +++ b/tests/features/chat/application/composer/suggestions.test.ts @@ -246,8 +246,12 @@ describe("composer suggestions", () => { activeNote: { name: "Beta Note", path: "topics/Beta Note.md", linktext: "Beta Note" }, selection: null, }, - }), - ).toEqual([]); + })[0], + ).toMatchObject({ + display: "Active file", + detail: "topics/Beta Note.md", + replacement: "[[Beta Note]]", + }); expect( activeComposerSuggestions("@sel", notes, [], [], [], null, { contextReferences: {