File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,15 @@ class SyntaxNode {
239239 return NodeMethods . toString ( this . tree ) ;
240240 }
241241
242+ toJSON ( ) {
243+ return {
244+ type : this . type ,
245+ startPosition : this . startPosition ,
246+ endPosition : this . endPosition ,
247+ childCount : this . childCount ,
248+ }
249+ }
250+
242251 child ( index ) {
243252 marshalNode ( this ) ;
244253 return unmarshalNode ( NodeMethods . child ( this . tree , index ) , this . tree ) ;
Original file line number Diff line number Diff line change @@ -340,6 +340,11 @@ declare module "tree-sitter" {
340340 */
341341 toString ( ) : string ;
342342
343+ /**
344+ * Convert this node to its JSON representation
345+ */
346+ toJSON ( ) : object ;
347+
343348 /**
344349 * Get the node's child at the given index, where zero represents the first child.
345350 *
You can’t perform that action at this time.
0 commit comments