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/Views/Repositories/FileTreeView.swift | 46 +---------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'Hutch/Views') 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