ChimeHQ / Neon

A Swift library for efficient, flexible content-based text styling
BSD 3-Clause "New" or "Revised" License
320 stars 18 forks source link

async version of currentTree #15

Closed kaunteya closed 1 year ago

kaunteya commented 1 year ago

Hi I have this snippet in my code

extension TreeSitterClient {
    func currentTree() async throws -> Tree? {
        try await withCheckedThrowingContinuation { continuation in
            currentTree() { result in
                switch result {
                case .failure: continuation.resume(returning: nil)
                case .success(let tree):
                    continuation.resume(returning: tree)
                }
            }
        }
    }
}

Do you think it would make sense to have this function in the repo? I can open a PR

mattmassicotte commented 1 year ago

I think this makes a lot of sense! That PR would be very appreciated.