diff options
| author | Frank <[email protected]> | 2025-07-21 19:10:51 -0400 |
|---|---|---|
| committer | Frank <[email protected]> | 2025-07-21 19:10:57 -0400 |
| commit | 5611ef8b28216aa9dd2ceb6ed17d5779a29154f6 (patch) | |
| tree | a58c6dceb5f0e6243a6cbe3e4dc87a259119fd10 /packages/tui/internal/commands | |
| parent | bec796e3c3c097bfc7bb9090729ec23573151d79 (diff) | |
| download | opencode-5611ef8b28216aa9dd2ceb6ed17d5779a29154f6.tar.gz opencode-5611ef8b28216aa9dd2ceb6ed17d5779a29154f6.zip | |
wip: vscode extension
Diffstat (limited to 'packages/tui/internal/commands')
| -rw-r--r-- | packages/tui/internal/commands/command.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/packages/tui/internal/commands/command.go b/packages/tui/internal/commands/command.go index dde49e824..6015ab85b 100644 --- a/packages/tui/internal/commands/command.go +++ b/packages/tui/internal/commands/command.go @@ -63,17 +63,37 @@ func (r CommandRegistry) Sorted() []Command { commands = append(commands, command) } slices.SortFunc(commands, func(a, b Command) int { + // Priority order: session_new, session_share, model_list, app_help first, app_exit last + priorityOrder := map[CommandName]int{ + SessionNewCommand: 0, + AppHelpCommand: 1, + SessionShareCommand: 2, + ModelListCommand: 3, + } + + aPriority, aHasPriority := priorityOrder[a.Name] + bPriority, bHasPriority := priorityOrder[b.Name] + + if aHasPriority && bHasPriority { + return aPriority - bPriority + } + if aHasPriority { + return -1 + } + if bHasPriority { + return 1 + } if a.Name == AppExitCommand { return 1 } if b.Name == AppExitCommand { return -1 } + return strings.Compare(string(a.Name), string(b.Name)) }) return commands } - func (r CommandRegistry) Matches(msg tea.KeyPressMsg, leader bool) []Command { var matched []Command for _, command := range r.Sorted() { |
