Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async version of currentTree #15

Closed
kaunteya opened this issue Dec 24, 2022 · 1 comment
Closed

async version of currentTree #15

kaunteya opened this issue Dec 24, 2022 · 1 comment

Comments

@kaunteya
Copy link
Contributor

kaunteya commented Dec 24, 2022

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants