summaryrefslogtreecommitdiff
path: root/Hutch/Views
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-07-25 16:19:59 -0500
committerGitHub <[email protected]>2026-07-25 16:19:59 -0500
commite49a0760bf58735f19a7bcca1f4e7eeb38e4529d (patch)
treef9df840168143cdeb257ab302e8f4e5a9a30d478 /Hutch/Views
parenta02a11626c0bd0fa546b4cdda340392217554136 (diff)
parent25a8b406de5f9e9612c83a348a8bb50f86967942 (diff)
downloadhutch-e49a0760bf58735f19a7bcca1f4e7eeb38e4529d.tar.gz
hutch-e49a0760bf58735f19a7bcca1f4e7eeb38e4529d.tar.bz2
hutch-e49a0760bf58735f19a7bcca1f4e7eeb38e4529d.zip
Merge pull request #24 from zerolabsco/remove-splash-highlighter
Remove Splash syntax highlighter dependency
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