diff --git a/packages/app/src/shell/commands/search.ts b/packages/app/src/shell/commands/search.ts index 675a2a972b0..e545e0f01b4 100644 --- a/packages/app/src/shell/commands/search.ts +++ b/packages/app/src/shell/commands/search.ts @@ -91,7 +91,7 @@ export function createCommandPaletteSearch(props: { if (!current) return entries - const order = { command: 0, session: 1, file: 2, setting: 3 } + const order = { command: 0, setting: 1, session: 2, file: 3 } return entries.toSorted( (a, b) => diff --git a/packages/app/test-browser/command-palette-search.test.ts b/packages/app/test-browser/command-palette-search.test.ts index 868d6275b0b..10e21e887a0 100644 --- a/packages/app/test-browser/command-palette-search.test.ts +++ b/packages/app/test-browser/command-palette-search.test.ts @@ -12,6 +12,13 @@ const copy: CommandPaletteEntry = { const file: CommandPaletteEntry = { id: "file:copy.txt", type: "file", title: "copy.txt", category: "Files" } +const setting: CommandPaletteEntry = { + id: "setting:copy", + type: "setting", + title: "Copy on select", + category: "Settings", +} + const session: CommandPaletteEntry = { id: "session:copy", type: "session", @@ -52,7 +59,7 @@ describe("command palette search", () => { expect(signals[2].aborted).toBe(true) }) - test("publishes each source independently and drops stale results on a new query", async () => { + test("lists settings above sessions and files, publishes each source independently, and drops stale results on a new query", async () => { const files = Promise.withResolvers() const sessions = Promise.withResolvers() const fileVisible = Promise.withResolvers() @@ -63,7 +70,7 @@ describe("command palette search", () => { const search = createCommandPaletteSearch({ query, - items: () => [copy], + items: () => [copy, setting], sources: [() => sessions.promise, () => files.promise], }) @@ -76,17 +83,17 @@ describe("command palette search", () => { return { search, setQuery, dispose } }) - expect(root.search.items()).toEqual([copy]) + expect(root.search.items()).toEqual([copy, setting]) files.resolve([file]) await fileVisible.promise - expect(root.search.items()).toEqual([copy, file]) + expect(root.search.items()).toEqual([copy, setting, file]) expect(root.search.loading()).toBe(true) sessions.resolve([session]) await sessionVisible.promise - expect(root.search.items()).toEqual([copy, session, file]) + expect(root.search.items()).toEqual([copy, setting, session, file]) expect(root.search.loading()).toBe(false) root.setQuery("new query") - expect(root.search.items()).toEqual([copy]) + expect(root.search.items()).toEqual([copy, setting]) root.dispose() })