Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ public class TextViewController: NSViewController {
platformGuardedSystemCursor = false
}

if let idx = highlightProviders.firstIndex(where: { $0 is TreeSitterClient }),
let client = highlightProviders[idx] as? TreeSitterClient {
self.treeSitterClient = client
}

self.textView = TextView(
string: string,
font: font,
Expand Down
9 changes: 9 additions & 0 deletions Tests/CodeEditSourceEditorTests/TextViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,5 +418,14 @@ final class TextViewControllerTests: XCTestCase {
XCTAssertEqual(controller.cursorPositions[1].line, 3)
XCTAssertEqual(controller.cursorPositions[1].column, 1)
}

// MARK: - TreeSitterClient

func test_treeSitterSetUp() {
// Set up with a user-initiated `TreeSitterClient` should still use that client for things like tag
// completion.
let controller = Mock.textViewController(theme: Mock.theme())
XCTAssertNotNil(controller.treeSitterClient)
}
}
// swiftlint:enable all
Loading