Restore active note mention completion alias

This commit is contained in:
murashit 2026-07-07 22:50:37 +09:00
parent 22be754296
commit a330f181b5
2 changed files with 11 additions and 3 deletions

View file

@ -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,

View file

@ -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: {