I’m currently working on a completion context function for a nested language. I need to use the syntax tree of the nested language in order to make decisions about what to return in the autocomplete. However, I find that when I call syntaxTree(context.state)
, it only gives me information about the outer language and not the inner language.
I’ve put together an example to demonstrate this behavior. The example nests javascript inside of python (which is a bit horrible) inside of a fake javascript
function. I am using the overlay
option in parseMixed
so that everything inside of the python function string is parsed by the javascript parser (I need to use the overlay
option so I don’t also parse the quotes that wrap the javascript code).
If you use the example and trigger the autocomplete within the javascript portion, you can see that it logs all of the node types for the python nodes, but it doesn’t log any of the nodes for javascript–it just says String
which describes the entire javascript block.
Is there a way to access the parse tree of the inner language in this context? I went looking in the docs and found MountedTree
that seems related to what I’m asking about but I don’t see a clear way to make use of that class to do what I’m after.