summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohn Henry Rudden <[email protected]>2025-07-13 14:47:26 -0500
committerGitHub <[email protected]>2025-07-13 14:47:26 -0500
commitf04a5e50ee771d190f1d5fdcb7780c156e3a70b3 (patch)
tree7cf50d790a333ff91959eb535598c6b0680bdd5d
parentbb28b707001653f14c0d401a57c1f6772e666e41 (diff)
downloadopencode-f04a5e50ee771d190f1d5fdcb7780c156e3a70b3.tar.gz
opencode-f04a5e50ee771d190f1d5fdcb7780c156e3a70b3.zip
fix: deduplicate command suggestions (#934)
-rw-r--r--packages/tui/internal/completions/commands.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/tui/internal/completions/commands.go b/packages/tui/internal/completions/commands.go
index bb48d540c..d7e21419b 100644
--- a/packages/tui/internal/completions/commands.go
+++ b/packages/tui/internal/completions/commands.go
@@ -96,11 +96,16 @@ func (c *CommandCompletionProvider) GetChildEntries(
// Sort by score (best matches first)
sort.Sort(matches)
- // Convert matches to completion items
+ // Convert matches to completion items, deduplicating by command name
items := []dialog.CompletionItemI{}
+ seen := make(map[string]bool)
for _, match := range matches {
if item, ok := commandMap[match.Target]; ok {
- items = append(items, item)
+ // Use the command's value (name) as the deduplication key
+ if !seen[item.GetValue()] {
+ seen[item.GetValue()] = true
+ items = append(items, item)
+ }
}
}
return items, nil