Skip to content

Binding Inconsistencies #19

Open
Open
@topi314

Description

@topi314

Hi, first of all I appreciate the effort to provide updated & maintained go bindings for tree-sitter.
Previously I was using https://github.com/smacker/go-tree-sitter which I had to fork to get rid of all the included tree-sitter grammars & make major breaking changes to be able to work with it.

My objective is to have good looking syntax highlighting and for this I ported the highlight crate of the official tree-sitter rust bindings to go. I had major pain points with missing features with the old module which are now gone.

While porting my highlighting code to this module I found 2 things I am wondering about:

  1. github.com/smacker/go-tree-sitter used uint32 in most places which seem to have been replaced with uint in this module except for: https://github.com/tree-sitter/go-tree-sitter/blob/master/query.go#L113
    Is this intended or just an oversight?

  2. From what I can tell the Node struct should be passed around as a pointer. There are 3 places where they are handled as values instead which makes dealing with nodes a little bit annoying in those cases:

    1. Node Node
    2. func (tc *TreeCursor) Reset(node Node) {
    3. func (qm *QueryMatch) NodesForCaptureIndex(captureIndex uint) []Node {

      Is there also any specific reason this has been done?

Besides this I haven't ran into any issues, thanks for this awesome work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions