@@ -117,6 +117,22 @@ struct PluginMetadataSnapshot: Sendable {
117117 additionalConnectionFields: [ ]
118118 )
119119 }
120+
121+ func withIconName( _ newIconName: String ) -> PluginMetadataSnapshot {
122+ PluginMetadataSnapshot (
123+ displayName: displayName, iconName: newIconName, defaultPort: defaultPort,
124+ requiresAuthentication: requiresAuthentication, supportsForeignKeys: supportsForeignKeys,
125+ supportsSchemaEditing: supportsSchemaEditing, isDownloadable: isDownloadable,
126+ primaryUrlScheme: primaryUrlScheme, parameterStyle: parameterStyle,
127+ navigationModel: navigationModel, explainVariants: explainVariants,
128+ pathFieldRole: pathFieldRole, supportsHealthMonitor: supportsHealthMonitor,
129+ urlSchemes: urlSchemes, postConnectActions: postConnectActions,
130+ brandColorHex: brandColorHex, queryLanguageName: queryLanguageName,
131+ editorLanguage: editorLanguage, connectionMode: connectionMode,
132+ supportsDatabaseSwitching: supportsDatabaseSwitching,
133+ capabilities: capabilities, schema: schema, editor: editor, connection: connection
134+ )
135+ }
120136}
121137
122138final class PluginMetadataRegistry : @unchecked Sendable {
@@ -513,11 +529,15 @@ final class PluginMetadataRegistry: @unchecked Sendable {
513529 reverseTypeIndex [ " ScyllaDB " ] = " Cassandra "
514530 }
515531
516- func register( snapshot: PluginMetadataSnapshot , forTypeId typeId: String ) {
532+ func register( snapshot: PluginMetadataSnapshot , forTypeId typeId: String , preserveIcon : Bool = false ) {
517533 lock. lock ( )
518534 defer { lock. unlock ( ) }
519- snapshots [ typeId] = snapshot
520- for scheme in snapshot. urlSchemes {
535+ var resolved = snapshot
536+ if preserveIcon, let existingIcon = snapshots [ typeId] ? . iconName {
537+ resolved = snapshot. withIconName ( existingIcon)
538+ }
539+ snapshots [ typeId] = resolved
540+ for scheme in resolved. urlSchemes {
521541 schemeIndex [ scheme. lowercased ( ) ] = typeId
522542 }
523543 }
@@ -594,15 +614,9 @@ final class PluginMetadataRegistry: @unchecked Sendable {
594614 let schemes = driverType. urlSchemes
595615 let primaryScheme = schemes. first ?? driverType. databaseTypeId. lowercased ( )
596616
597- // Prefer the registry default's custom icon (e.g. "mysql-icon") over the
598- // plugin's generic SF Symbol (e.g. "cylinder.fill"). The registry defaults
599- // have curated SVG icons in the asset catalog.
600- let existingIcon = snapshot ( forTypeId: driverType. databaseTypeId) ? . iconName
601- let iconName = existingIcon ?? driverType. iconName
602-
603617 return PluginMetadataSnapshot (
604618 displayName: driverType. databaseDisplayName,
605- iconName: iconName,
619+ iconName: driverType . iconName,
606620 defaultPort: driverType. defaultPort,
607621 requiresAuthentication: driverType. requiresAuthentication,
608622 supportsForeignKeys: driverType. supportsForeignKeys,
0 commit comments