Skip to content

Bump TreeSitter version to 0.25.6 #402

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ewilken
Copy link

@ewilken ewilken commented Jun 27, 2025

Here we go again, as a continuation of #401. 🙂

TSLanguage doesn't seem to be publicly exported anymore on the latest version of tree-sitter (or its Swift package wrapper), so I've used OpaquePointers, inspired by swift-tree-sitter's implementation. Eyeballing it, it didn't break anything for me, but please let me know what you think of this.

@Copilot Copilot AI review requested due to automatic review settings June 27, 2025 17:46
@ewilken ewilken requested a review from simonbs as a code owner June 27, 2025 17:46
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Tree-sitter dependency to v0.25.6 and adapts the Swift wrapper API to use opaque pointers and new encoding parameters.

  • Upgraded the Tree-sitter Swift package version to 0.25.6.
  • Replaced all UnsafePointer<TSLanguage> usage with OpaquePointer for language references.
  • Updated TSInput initializer to include a new decode parameter and added explicit UTF-16LE/BE string encoding support.
Comments suppressed due to low confidence (1)

Sources/Runestone/TreeSitter/TreeSitterTextInput.swift:24

  • Providing nil for the decode callback may break parsing of non-ASCII text under UTF-16LE/BE encodings because Tree-sitter relies on a decode function to convert bytes to codepoints. Consider supplying a proper decode callback (as in swift-tree-sitter) or verifying that default behavior works for all target encodings.
        return TSInput(payload: payload, read: read, encoding: encoding, decode: nil)

@@ -81,8 +81,10 @@ private extension TSInputEncoding {
switch self {
case TSInputEncodingUTF8:
return .utf8
case TSInputEncodingUTF16:
return String.preferredUTF16Encoding
case TSInputEncodingUTF16LE:
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original TSInputEncodingUTF16 case was removed from stringEncoding, so any code still using TSInputEncodingUTF16 will fall through and return nil, causing silent parse failures. Consider explicitly handling or deprecating UTF16, or adding a mapping for it.

Copilot uses AI. Check for mistakes.

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

Successfully merging this pull request may close these issues.

1 participant