Skip to content

Commit d2a78fb

Browse files
annikaschmidclaude
andauthored
fix: show all slash commands in suggestion dropdown (#1175)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 04e6b5e commit d2a78fb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

apps/code/src/renderer/features/message-editor/suggestions/getSuggestions.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import Fuse, { type IFuseOptions } from "fuse.js";
66
import { useDraftStore } from "../stores/draftStore";
77
import type { CommandSuggestionItem, FileSuggestionItem } from "../types";
88

9-
const COMMAND_LIMIT = 5;
10-
119
const COMMAND_FUSE_OPTIONS: IFuseOptions<AvailableCommand> = {
1210
keys: [
1311
{ name: "name", weight: 0.7 },
@@ -22,11 +20,11 @@ function searchCommands(
2220
query: string,
2321
): AvailableCommand[] {
2422
if (!query.trim()) {
25-
return commands.slice(0, COMMAND_LIMIT);
23+
return commands;
2624
}
2725

2826
const fuse = new Fuse(commands, COMMAND_FUSE_OPTIONS);
29-
const results = fuse.search(query, { limit: COMMAND_LIMIT * 2 });
27+
const results = fuse.search(query);
3028

3129
const lowerQuery = query.toLowerCase();
3230
results.sort((a, b) => {
@@ -38,7 +36,7 @@ function searchCommands(
3836
return (a.score ?? 0) - (b.score ?? 0);
3937
});
4038

41-
return results.slice(0, COMMAND_LIMIT).map((result) => result.item);
39+
return results.map((result) => result.item);
4240
}
4341

4442
export async function getFileSuggestions(

0 commit comments

Comments
 (0)