From 25a8b406de5f9e9612c83a348a8bb50f86967942 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sat, 25 Jul 2026 16:18:52 -0500 Subject: Remove Splash syntax highlighter dependency Splash only highlights Swift, leaving every other language unhighlighted. Drop the dependency entirely and render file contents as plain text until a broader-coverage highlighter is adopted. - Remove `import Splash` and the Splash-backed theming in FileTreeView - Simplify CodeSyntaxHighlighter to emit plain attributed text - Remove the Splash SwiftPM package reference and product dependency Refs https://github.com/zerolabsco/hutch/issues/16 Co-Authored-By: Claude Opus 4.8 --- Hutch.xcodeproj/project.pbxproj | 17 -------- .../xcshareddata/swiftpm/Package.resolved | 9 ----- Hutch/Views/Repositories/FileTreeView.swift | 46 +--------------------- 3 files changed, 1 insertion(+), 71 deletions(-) diff --git a/Hutch.xcodeproj/project.pbxproj b/Hutch.xcodeproj/project.pbxproj index 409df4b..5e410eb 100644 --- a/Hutch.xcodeproj/project.pbxproj +++ b/Hutch.xcodeproj/project.pbxproj @@ -20,7 +20,6 @@ 8BE082012F80000100000001 /* HutchWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 8BE081F62F80000100000001 /* HutchWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 8BE083012F81000100000001 /* HutchSafariExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 8BE083032F81000100000001 /* HutchSafariExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 8BF100032F9A000100000001 /* Markdown in Frameworks */ = {isa = PBXBuildFile; productRef = 8BF100022F9A000100000001 /* Markdown */; }; - 8BF100052F9A000100000002 /* Splash in Frameworks */ = {isa = PBXBuildFile; productRef = 8BF100042F9A000100000002 /* Splash */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -149,7 +148,6 @@ buildActionMask = 2147483647; files = ( 8BF100032F9A000100000001 /* Markdown in Frameworks */, - 8BF100052F9A000100000002 /* Splash in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -254,7 +252,6 @@ name = Hutch; packageProductDependencies = ( 8BF100022F9A000100000001 /* Markdown */, - 8BF100042F9A000100000002 /* Splash */, ); productName = Hutch; productReference = 8B4B28D12F6704280045FA19 /* Hutch.app */; @@ -361,7 +358,6 @@ minimizedProjectReferenceProxies = 1; packageReferences = ( 8BF100012F9A000100000001 /* XCRemoteSwiftPackageReference "swift-markdown" */, - 8BF100062F9A000100000002 /* XCRemoteSwiftPackageReference "Splash" */, ); preferredProjectObjectVersion = 77; productRefGroup = 8B4B28D22F6704280045FA19 /* Products */; @@ -883,14 +879,6 @@ minimumVersion = 0.8.0; }; }; - 8BF100062F9A000100000002 /* XCRemoteSwiftPackageReference "Splash" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/JohnSundell/Splash"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 0.16.0; - }; - }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -899,11 +887,6 @@ package = 8BF100012F9A000100000001 /* XCRemoteSwiftPackageReference "swift-markdown" */; productName = Markdown; }; - 8BF100042F9A000100000002 /* Splash */ = { - isa = XCSwiftPackageProductDependency; - package = 8BF100062F9A000100000002 /* XCRemoteSwiftPackageReference "Splash" */; - productName = Splash; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 8B4B28C92F6704280045FA19 /* Project object */; diff --git a/Hutch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Hutch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 55263b9..417e4d7 100644 --- a/Hutch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Hutch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,15 +1,6 @@ { "originHash" : "65542d8a5fbbad8dd7d07c8901c1cc48b3aba12cef8da1f062bd28d9b3a6ba50", "pins" : [ - { - "identity" : "splash", - "kind" : "remoteSourceControl", - "location" : "https://github.com/JohnSundell/Splash", - "state" : { - "revision" : "7f4df436eb78fe64fe2c32c58006e9949fa28ad8", - "version" : "0.16.0" - } - }, { "identity" : "swift-cmark", "kind" : "remoteSourceControl", diff --git a/Hutch/Views/Repositories/FileTreeView.swift b/Hutch/Views/Repositories/FileTreeView.swift index b49f361..7bfce17 100644 --- a/Hutch/Views/Repositories/FileTreeView.swift +++ b/Hutch/Views/Repositories/FileTreeView.swift @@ -1,4 +1,3 @@ -import Splash import SwiftUI import UIKit @@ -739,39 +738,7 @@ private struct CodeFileLineData { } private enum CodeSyntaxHighlighter { - static func attributedText(for text: String, fileName: String, font: UIFont) -> NSAttributedString { - guard supportsSplashHighlighting(fileName: fileName) else { - return plainText(text, font: font) - } - - var splashFont = Font(size: Double(font.pointSize)) - splashFont.resource = .preloaded(font) - - let theme = Theme( - font: splashFont, - plainTextColor: .label, - tokenColors: [ - .keyword: .systemPink, - .string: .systemRed, - .type: .systemTeal, - .call: .systemBlue, - .number: .systemPurple, - .comment: .secondaryLabel, - .property: .systemGreen, - .dotAccess: .systemIndigo, - .preprocessing: .systemOrange - ], - backgroundColor: .clear - ) - - let highlighted = SyntaxHighlighter( - format: AttributedStringOutputFormat(theme: theme) - ).highlight(text) - - return NSMutableAttributedString(attributedString: highlighted) - } - - private static func plainText(_ text: String, font: UIFont) -> NSAttributedString { + static func attributedText(for text: String, fileName _: String, font: UIFont) -> NSAttributedString { NSAttributedString( string: text, attributes: [ @@ -780,17 +747,6 @@ private enum CodeSyntaxHighlighter { ] ) } - - private static func supportsSplashHighlighting(fileName: String) -> Bool { - let supportedExtensions: Set = [ - "swift", - "swiftinterface", - "playground" - ] - return supportedExtensions.contains( - (fileName as NSString).pathExtension.lowercased() - ) - } } // MARK: - Tree Entry Row -- cgit v1.2.3