added syntax highlighting - and a new runtime error :cry

This commit is contained in:
neon443 committed 2025-06-21 12:50:28 +01:00
1 parent cf5feaacc2
commit 5fafc52913
1 file changed
+13
@@ -9,12 +9,15 @@ import Foundation
import UIKit
import SwiftUI
import Runestone
import TreeSitterBashRunestone
struct TextViewController: UIViewRepresentable {
@Binding var text: String
func makeUIView(context: Context) -> TextView {
let languageMode = TreeSitterLanguageMode(language: .bash)
let textView = TextView()
setTextViewState(on: textView)
textView.translatesAutoresizingMaskIntoConstraints = false
textView.backgroundColor = .systemBackground
return textView
@@ -23,4 +26,14 @@ struct TextViewController: UIViewRepresentable {
func updateUIView(_ textView: TextView, context: Context) {
textView.text = text
}
private func setTextViewState(on textView: TextView) {
DispatchQueue.global(qos: .userInitiated).async {
let text = self.text
let state = TextViewState(text: text, language: .bash)
DispatchQueue.main.async {
textView.setState(state)
}
}
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.