Closed maxbrunsfeld closed 6 years ago
Pretty cool that you can interop between two native Node extensions this way. 🤘
Ok, I have a new, better approach. In https://github.com/atom/superstring/pull/65, I've added an API in superstring that allows other native modules (like this one) to access the contents of a TextBuffer::Snapshot
directly from C++ in terms of simple primitives and STL objects, without having to call any methods from superstring.
This is also cleaner because it means I only have to vendor one small header file from superstring in this repo.
This PR adds a new asynchronous API that allows parsing superstring text buffers on background threads.
As with the regular
parse
function,parseTextBuffer
can re-use an existing syntax tree:Implementation
In
parseTextBuffer
, we call theTextBuffer
object's C++ APIs directly. Currently, I do this by including a bunch of header files fromsuperstring
in thevendor
folder ofnode-tree-sitter
./cc @nathansobo