This adds a .text property to syntax nodes so that you can conveniently access their text without having to manually slice the source string using the node's startIndex and endIndex.
I was originally hesitant to add this because it was trivially achievable already and I wasn't sure if all applications would want to retain the source string in memory after parsing, but it seems like most users probably want this.
This adds a
.text
property to syntax nodes so that you can conveniently access their text without having to manually slice the source string using the node'sstartIndex
andendIndex
.I was originally hesitant to add this because it was trivially achievable already and I wasn't sure if all applications would want to retain the source string in memory after parsing, but it seems like most users probably want this.
Closes https://github.com/tree-sitter/node-tree-sitter/issues/22