Refer to @codemirror/lang-java source package implementation. Added my own extension as follows:
Facet.define().of(
foldNodeProp.add({
["ImportDeclaration"]: foldInside,
BlockComment(tree) { return { from: tree.from + 2, to: tree.to - 2 }; }
})
)
I recommend you read the docs a bit more, because that is not how things work. You’re defining a facet that’s then never used, and passing it a value that should be used to configure a parser instead. The library doesn’t use global side effects, so you definitely can’t configure anything by just calling some function and then doing nothing with the result. Look into LRLanguage.configure
, that’s where props are added to parsers.