ChimeHQ / SwiftTreeSitter

Swift API for the tree-sitter incremental parsing system
BSD 3-Clause "New" or "Revised" License
271 stars 30 forks source link

How to get text with range? #11

Closed chenfanfang closed 2 years ago

chenfanfang commented 2 years ago

help me please. can you tell me how to get text with range? thanks!

mattmassicotte commented 2 years ago

SwiftTreeSitter is text system-independent. This means that it does not have a way to get the text contents directly. You must connect it to the system you are using. If you have, for example, a Node value, you can access its range within your text. But, it is up to you to use that range to get the content.

I hope this is helpful!

chenfanfang commented 2 years ago

I see, thank you