Browse Source

fix: Sort themes in the /theme modal alphabetically (resolves #5217) (#5219)

Co-authored-by: Aiden Cline <[email protected]>
Ariane Emory 2 months ago
parent
commit
63e54541fe
1 changed files with 6 additions and 4 deletions
  1. 6 4
      packages/opencode/src/cli/cmd/tui/component/dialog-theme-list.tsx

+ 6 - 4
packages/opencode/src/cli/cmd/tui/component/dialog-theme-list.tsx

@@ -5,10 +5,12 @@ import { onCleanup, onMount } from "solid-js"
 
 export function DialogThemeList() {
   const theme = useTheme()
-  const options = Object.keys(theme.all()).map((value) => ({
-    title: value,
-    value: value,
-  }))
+  const options = Object.keys(theme.all())
+    .sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base' }))
+    .map((value) => ({
+      title: value,
+      value: value,
+    }))
   const dialog = useDialog()
   let confirmed = false
   let ref: DialogSelectRef<string>