JavaScript Highlighter: batch attributed string updates to vastly improve

performance
Esse commit está contido em:
Shadowfacts 2020-04-06 19:31:35 -04:00
commit d353fabd69
Assinado por: shadowfacts
ID da chave GPG: 94A5AB95422746E5
1 arquivos alterados com 3 adições e 0 exclusões

Ver arquivo

@ -73,6 +73,7 @@ class JavaScriptHighlighter {
}
func highlight() {
attributed.beginEditing()
let fullRange = NSRange(location: 0, length: attributed.length)
attributed.setAttributes([
.foregroundColor: NSColor.textColor,
@ -83,6 +84,8 @@ class JavaScriptHighlighter {
while let char = peek(), !expressionEnds.contains(char) {
consumeExpression()
}
attributed.endEditing()
}
private func emit(token: TokenType, range: NSRange) {