mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Restore active note mention completion alias
This commit is contained in:
parent
22be754296
commit
a330f181b5
2 changed files with 11 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue