Add grouping and override filtering to the config editor list - #24
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Replaces the [(group: ConfigVariableGroup?, items: ...)] array, which used a nil group as a sentinel for ungrouped items, with a GroupedVariables typealias splitting grouped sections from the remainder.
…iously it didn't in worktrees)
Code Coverage ReportOverall Coverage: 96.99% (3,388 of 3,493) DevConfiguration: 96.99% (3,388 of 3,493)
|
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
So we don’t want to do grouping in the filtered view?
I would think 1) we should, and 2) that would actually make this code a bit simpler. We could do filtering in the view model and the view code is simple.
There was a problem hiding this comment.
🤷♂️
If you have lots of groups, but not a lot of overrides, the section headers produce a lot of visual clutter (obviously we'd hide empty sections)
On the other hand, if you have lots of overrides, you do lose some navigability by hiding the sections.
There was a problem hiding this comment.
Another solution (that I don't love) would be to make grouping a second toggle.
| /// ConfigVariable(key: "api.timeout", defaultValue: 30) | ||
| /// .metadata(\.group, .networking) | ||
| /// | ||
| public struct ConfigVariableGroup: Hashable, Sendable, Comparable { |
There was a problem hiding this comment.
This feels like a text book TypedExtensibleEnum to me.
There was a problem hiding this comment.
🤔 For some reason I thought we got ride of TypdExtensibleEnum in DevFoundation
|
|
||
| static func displayText(for value: ConfigVariableGroup?) -> String? { | ||
| value?.rawValue | ||
| } |
There was a problem hiding this comment.
I believe you get this implementation for free.
From ConfigVariableMetadata.swift:220-224:
extension ConfigVariableMetadataKey where Value: OptionalRepresentable, Value.Wrapped: RawRepresentable<String> {
public static func displayText(for value: Value) -> String? {
return value.optionalRepresentation.map { $0.rawValue }
}
}Combines grouping and override/search filtering into one view model property so the view no longer needs to branch on showOverridesOnly or reason about "remainder" groups and empty-section checks; section titles are now fully resolved by the view model.
Adopts the shared TypedExtensibleEnum protocol instead of hand-rolling Hashable/Sendable conformance, and drops the now-redundant displayText(for:) override.
|
Updated toolbar behavior: RocketSim_Recording_iPhone_17_6.3_2026-07-26_21.43.44_converted.mp4 |
Summary
ConfigVariableGroup/GroupMetadataKeymetadata so config variables can be grouped into labeled sections in the editor list, with ungrouped variables collected into a separate section.ContentViewModelto demonstrate groupingVariable Grouping
List Filtering