Commit 8ffc0de059
8ffc0de05925dbe512097b00654f8808b568c481
parent: 3350888a7a
Unsigned
cmc <hello@cleberg.net> · 2026-07-25 21:18 UTC
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
Layout: unified · split
Hutch.xcodeproj/project.pbxproj
−17
| @@ -20,7 +20,6 @@ |
| 20 | 20 | 8BE082012F80000100000001 /* HutchWidgetExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 8BE081F62F80000100000001 /* HutchWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; |
| 21 | 21 | 8BE083012F81000100000001 /* HutchSafariExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 8BE083032F81000100000001 /* HutchSafariExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; |
| 22 | 22 | 8BF100032F9A000100000001 /* Markdown in Frameworks */ = {isa = PBXBuildFile; productRef = 8BF100022F9A000100000001 /* Markdown */; }; |
| 23 | | 8BF100052F9A000100000002 /* Splash in Frameworks */ = {isa = PBXBuildFile; productRef = 8BF100042F9A000100000002 /* Splash */; }; |
| 24 | 23 | /* End PBXBuildFile section */ |
| 25 | 24 | |
| 26 | 25 | /* Begin PBXContainerItemProxy section */ |
| @@ -149,7 +148,6 @@ |
| 149 | 148 | buildActionMask = 2147483647; |
| 150 | 149 | files = ( |
| 151 | 150 | 8BF100032F9A000100000001 /* Markdown in Frameworks */, |
| 152 | | 8BF100052F9A000100000002 /* Splash in Frameworks */, |
| 153 | 151 | ); |
| 154 | 152 | runOnlyForDeploymentPostprocessing = 0; |
| 155 | 153 | }; |
| @@ -254,7 +252,6 @@ |
| 254 | 252 | name = Hutch; |
| 255 | 253 | packageProductDependencies = ( |
| 256 | 254 | 8BF100022F9A000100000001 /* Markdown */, |
| 257 | | 8BF100042F9A000100000002 /* Splash */, |
| 258 | 255 | ); |
| 259 | 256 | productName = Hutch; |
| 260 | 257 | productReference = 8B4B28D12F6704280045FA19 /* Hutch.app */; |
| @@ -361,7 +358,6 @@ |
| 361 | 358 | minimizedProjectReferenceProxies = 1; |
| 362 | 359 | packageReferences = ( |
| 363 | 360 | 8BF100012F9A000100000001 /* XCRemoteSwiftPackageReference "swift-markdown" */, |
| 364 | | 8BF100062F9A000100000002 /* XCRemoteSwiftPackageReference "Splash" */, |
| 365 | 361 | ); |
| 366 | 362 | preferredProjectObjectVersion = 77; |
| 367 | 363 | productRefGroup = 8B4B28D22F6704280045FA19 /* Products */; |
| @@ -883,14 +879,6 @@ |
| 883 | 879 | minimumVersion = 0.8.0; |
| 884 | 880 | }; |
| 885 | 881 | }; |
| 886 | | 8BF100062F9A000100000002 /* XCRemoteSwiftPackageReference "Splash" */ = { |
| 887 | | isa = XCRemoteSwiftPackageReference; |
| 888 | | repositoryURL = "https://github.com/JohnSundell/Splash"; |
| 889 | | requirement = { |
| 890 | | kind = upToNextMajorVersion; |
| 891 | | minimumVersion = 0.16.0; |
| 892 | | }; |
| 893 | | }; |
| 894 | 882 | /* End XCRemoteSwiftPackageReference section */ |
| 895 | 883 | |
| 896 | 884 | /* Begin XCSwiftPackageProductDependency section */ |
| @@ -899,11 +887,6 @@ |
| 899 | 887 | package = 8BF100012F9A000100000001 /* XCRemoteSwiftPackageReference "swift-markdown" */; |
| 900 | 888 | productName = Markdown; |
| 901 | 889 | }; |
| 902 | | 8BF100042F9A000100000002 /* Splash */ = { |
| 903 | | isa = XCSwiftPackageProductDependency; |
| 904 | | package = 8BF100062F9A000100000002 /* XCRemoteSwiftPackageReference "Splash" */; |
| 905 | | productName = Splash; |
| 906 | | }; |
| 907 | 890 | /* End XCSwiftPackageProductDependency section */ |
| 908 | 891 | }; |
| 909 | 892 | rootObject = 8B4B28C92F6704280045FA19 /* Project object */; |
Hutch.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
−9
| @@ -1,15 +1,6 @@ |
| 1 | 1 | { |
| 2 | 2 | "originHash" : "65542d8a5fbbad8dd7d07c8901c1cc48b3aba12cef8da1f062bd28d9b3a6ba50", |
| 3 | 3 | "pins" : [ |
| 4 | | { |
| 5 | | "identity" : "splash", |
| 6 | | "kind" : "remoteSourceControl", |
| 7 | | "location" : "https://github.com/JohnSundell/Splash", |
| 8 | | "state" : { |
| 9 | | "revision" : "7f4df436eb78fe64fe2c32c58006e9949fa28ad8", |
| 10 | | "version" : "0.16.0" |
| 11 | | } |
| 12 | | }, |
| 13 | 4 | { |
| 14 | 5 | "identity" : "swift-cmark", |
| 15 | 6 | "kind" : "remoteSourceControl", |
Hutch/Views/Repositories/FileTreeView.swift
+1 −45
| @@ -1,4 +1,3 @@ |
| 1 | | import Splash |
| 2 | 1 | import SwiftUI |
| 3 | 2 | import UIKit |
| 4 | 3 | |
| @@ -739,39 +738,7 @@ private struct CodeFileLineData { |
| 739 | 738 | } |
| 740 | 739 | |
| 741 | 740 | private enum CodeSyntaxHighlighter { |
| 742 | | static func attributedText(for text: String, fileName: String, font: UIFont) -> NSAttributedString { |
| 743 | | guard supportsSplashHighlighting(fileName: fileName) else { |
| 744 | | return plainText(text, font: font) |
| 745 | | } |
| 746 | | |
| 747 | | var splashFont = Font(size: Double(font.pointSize)) |
| 748 | | splashFont.resource = .preloaded(font) |
| 749 | | |
| 750 | | let theme = Theme( |
| 751 | | font: splashFont, |
| 752 | | plainTextColor: .label, |
| 753 | | tokenColors: [ |
| 754 | | .keyword: .systemPink, |
| 755 | | .string: .systemRed, |
| 756 | | .type: .systemTeal, |
| 757 | | .call: .systemBlue, |
| 758 | | .number: .systemPurple, |
| 759 | | .comment: .secondaryLabel, |
| 760 | | .property: .systemGreen, |
| 761 | | .dotAccess: .systemIndigo, |
| 762 | | .preprocessing: .systemOrange |
| 763 | | ], |
| 764 | | backgroundColor: .clear |
| 765 | | ) |
| 766 | | |
| 767 | | let highlighted = SyntaxHighlighter( |
| 768 | | format: AttributedStringOutputFormat(theme: theme) |
| 769 | | ).highlight(text) |
| 770 | | |
| 771 | | return NSMutableAttributedString(attributedString: highlighted) |
| 772 | | } |
| 773 | | |
| 774 | | private static func plainText(_ text: String, font: UIFont) -> NSAttributedString { |
| 741 | static func attributedText(for text: String, fileName _: String, font: UIFont) -> NSAttributedString { |
| 775 | 742 | NSAttributedString( |
| 776 | 743 | string: text, |
| 777 | 744 | attributes: [ |
| @@ -780,17 +747,6 @@ private enum CodeSyntaxHighlighter { |
| 780 | 747 | ] |
| 781 | 748 | ) |
| 782 | 749 | } |
| 783 | | |
| 784 | | private static func supportsSplashHighlighting(fileName: String) -> Bool { |
| 785 | | let supportedExtensions: Set<String> = [ |
| 786 | | "swift", |
| 787 | | "swiftinterface", |
| 788 | | "playground" |
| 789 | | ] |
| 790 | | return supportedExtensions.contains( |
| 791 | | (fileName as NSString).pathExtension.lowercased() |
| 792 | | ) |
| 793 | | } |
| 794 | 750 | } |
| 795 | 751 | |
| 796 | 752 | // MARK: - Tree Entry Row |