Hi! After parsing, I want to highlight some nodes, depending on their values, as I understand this can be done with highlightTree
, so every time the document changes I call this piece of code:
for (let {from, to} of this.view.visibleRanges) {
syntaxTree(this.view.state).iterate({
from: from,
to: to,
enter: (node) => {
if (node.name === 'Assign') {
const child = node.node.getChild('Text');
if (child) {
highlightTree(child.toTree(),
highlighter,
(from: number, to: number, classes: string) => {
// how to apply the styles here?
})
}
}
}
})
}
I want to highlight the first Text node of the Assign tree, and for that I call highlightTree, however, what shoud I do inside putStyle
? I know it gives me the class, but what should I do with it? How do I apply it? Thanks!! Also, does highlightTree will be applied after the default highlighter runs, or before? Because the default rule is the one being applied, and that’s what I want to change.