aboutsummaryrefslogtreecommitdiff
path: root/Hutch/Views
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-07-25 16:18:52 -0500
committerChristian Cleberg <[email protected]>2026-07-25 16:18:52 -0500
commit25a8b406de5f9e9612c83a348a8bb50f86967942 (patch)
treef9df840168143cdeb257ab302e8f4e5a9a30d478 /Hutch/Views
parenta02a11626c0bd0fa546b4cdda340392217554136 (diff)
downloadhutch-remove-splash-highlighter.tar.gz
hutch-remove-splash-highlighter.tar.bz2
hutch-remove-splash-highlighter.zip
Remove Splash syntax highlighter dependencyremove-splash-highlighter
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 <[email protected]>
Diffstat (limited to 'Hutch/Views')
-rw-r--r--Hutch/Views/Repositories/FileTreeView.swift46
1 files changed, 1 insertions, 45 deletions
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<String> = [
- "swift",
- "swiftinterface",
- "playground"
- ]
- return supportedExtensions.contains(
- (fileName as NSString).pathExtension.lowercased()
- )
- }
}
// MARK: - Tree Entry Row