Compare commits
No commits in common. "aef05153a220b4518a681edfcbd2f4f555f847bf" and "6b39e90ea4f4675d248668e8fce4c1c6f1f4a315" have entirely different histories.
aef05153a2
...
6b39e90ea4
|
@ -225,6 +225,8 @@ class JavaScriptHighlighter {
|
|||
consumeDotLookup()
|
||||
} else if char == "?" {
|
||||
consumeTernaryExpression()
|
||||
} else if expressionEnds.contains(char) {
|
||||
return
|
||||
} else {
|
||||
consume()
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
//
|
||||
|
||||
import AppKit
|
||||
import Combine
|
||||
|
||||
class JavaScriptEditorView: NSTextView {
|
||||
|
||||
|
@ -25,9 +24,6 @@ class JavaScriptEditorView: NSTextView {
|
|||
}
|
||||
}
|
||||
|
||||
private let rehighlightSubject = PassthroughSubject<Void, Never>()
|
||||
private var debouncedRehighlightCancellable: AnyCancellable!
|
||||
|
||||
func rehighlight() {
|
||||
isRehighlighting = true
|
||||
highlighter.highlight(attributed: self.textStorage!)
|
||||
|
@ -38,13 +34,6 @@ class JavaScriptEditorView: NSTextView {
|
|||
super.awakeFromNib()
|
||||
|
||||
textStorage!.delegate = self
|
||||
|
||||
typingAttributes = [
|
||||
.font: NSFont.monospacedSystemFont(ofSize: 13, weight: .regular),
|
||||
.foregroundColor: NSColor.textColor
|
||||
]
|
||||
|
||||
debouncedRehighlightCancellable = rehighlightSubject.throttle(for: .milliseconds(40), scheduler: RunLoop.main, latest: false).sink(receiveValue: rehighlight)
|
||||
}
|
||||
|
||||
override func shouldChangeText(in affectedCharRange: NSRange, replacementString: String?) -> Bool {
|
||||
|
@ -128,6 +117,6 @@ extension JavaScriptEditorView: NSTextStorageDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
rehighlightSubject.send()
|
||||
rehighlight()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue