Skip to content

Commit

Permalink
make executionMode injectable in TextViewHighlighter convenience init
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineDominion committed Nov 18, 2023
1 parent 28568d2 commit cbddda5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Sources/Neon/TextViewHighlighter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,21 @@ public final class TextViewHighlighter: NSObject {
treeSitterClient.invalidationHandler = { [weak self] in self?.handleInvalidation($0) }
}

public convenience init(textView: TextView, language: Language, highlightQuery: Query, attributeProvider: @escaping TextViewSystemInterface.AttributeProvider) throws {
public convenience init(
textView: TextView,
language: Language,
highlightQuery: Query,
executionMode: TreeSitterClient.ExecutionMode = .asynchronous(prefetch: true),
attributeProvider: @escaping TextViewSystemInterface.AttributeProvider
) throws {
let client = try TreeSitterClient(language: language, transformer: { _ in return .zero })

try self.init(textView: textView, client: client, highlightQuery: highlightQuery, attributeProvider: attributeProvider)
try self.init(
textView: textView,
client: client,
highlightQuery: highlightQuery,
executionMode: executionMode,
attributeProvider: attributeProvider)
}

@objc private func visibleContentChanged(_ notification: NSNotification) {
Expand Down

0 comments on commit cbddda5

Please sign in to comment.