Skip to content

Commit

Permalink
add range as exportable@
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Babik committed May 27, 2022
1 parent 610c0e4 commit d2a5a3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ func (n Node) EndPoint() Point {
}
}

func (n Node) Location() Range {
return Range{
n.StartPoint(), n.EndPoint(), n.StartByte(), n.EndByte(),
}
}

// Symbol returns the node's type as a Symbol.
func (n Node) Symbol() Symbol {
return C.ts_node_symbol(n.c)
Expand Down Expand Up @@ -523,7 +529,7 @@ func (n Node) ChildByFieldName(name string) *Node {

// FieldNameForChild returns the field name of the child at the given index, or "" if not named.
func (n Node) FieldNameForChild(idx int) string {
return C.GoString(C.ts_node_field_name_for_child(n.c, C.uint32_t(idx)))
return C.GoString(C.ts_node_field_name_for_child(n.c, C.uint32_t(idx)))
}

// NextSibling returns the node's next sibling.
Expand Down

0 comments on commit d2a5a3c

Please sign in to comment.