File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,6 +215,18 @@ internal struct ThemeStorage {
215215 }
216216 }
217217
218+ private static let builtInThemeOrder = [
219+ " tablepro.default-light " ,
220+ " tablepro.default-dark " ,
221+ " tablepro.dracula " ,
222+ " tablepro.solarized-light " ,
223+ " tablepro.solarized-dark " ,
224+ " tablepro.one-dark " ,
225+ " tablepro.github-light " ,
226+ " tablepro.github-dark " ,
227+ " tablepro.nord " ,
228+ ]
229+
218230 private static func loadBuiltInThemes( from directory: URL ) -> [ ThemeDefinition ] {
219231 let fm = FileManager . default
220232 guard fm. fileExists ( atPath: directory. path) else { return [ ] }
@@ -223,7 +235,12 @@ internal struct ThemeStorage {
223235 let files = try fm. contentsOfDirectory ( at: directory, includingPropertiesForKeys: nil )
224236 . filter { $0. pathExtension == " json " && $0. lastPathComponent. hasPrefix ( " tablepro. " ) }
225237
226- return files. compactMap { loadTheme ( from: $0) }
238+ let themes = files. compactMap { loadTheme ( from: $0) }
239+ return themes. sorted { lhs, rhs in
240+ let li = builtInThemeOrder. firstIndex ( of: lhs. id) ?? Int . max
241+ let ri = builtInThemeOrder. firstIndex ( of: rhs. id) ?? Int . max
242+ return li < ri
243+ }
227244 } catch {
228245 logger. error ( " Failed to list built-in themes: \( error) " )
229246 return [ ]
You can’t perform that action at this time.
0 commit comments