So in the past we already migrated our search box UI from monaco to the code mirror implementation
thanks to @fkling. Now we want to migrate other parts of the product to it. But there are a few blockers
JSON schema validation, I was afraid that due to JSONC format that we use we can't just use a standard
JSON schema validation parser, but I was wrong, we actually don't need to handle comments ourself or prepare
json by deleting the comments. Standard JSON schema validation handles it, it just skips the comment but respects
line and column position accordingly in case if they are somewhere after comments line.
JSONC (json with comments) format. At the moment code mirror doesn't support it out of the box, so
we should support it on the consumer level, but gladly code mirror API allows to provide any custom grammar
our imperative description of the grammar to support any context-free language (in theory you can support any
language, it's always about grammar definition complexity. Back to jsonc format, it simple JSON but with two
possible ways to define comments
standard inline comment starts // and ends with EOL symbol \n
standard block-based comment with /* .... */
So to define grammar I think we should pick Lezer package. It appears to be a standard way for code mirror to define lang grammars. So for example JSON with comments grammar may looks like this
So in the past we already migrated our search box UI from monaco to the code mirror implementation thanks to @fkling. Now we want to migrate other parts of the product to it. But there are a few blockers
JSONC (json with comments) format. At the moment code mirror doesn't support it out of the box, so we should support it on the consumer level, but gladly code mirror API allows to provide any custom grammar our imperative description of the grammar to support any context-free language (in theory you can support any language, it's always about grammar definition complexity. Back to jsonc format, it simple JSON but with two possible ways to define comments
//
and ends with EOL symbol\n
/* .... */
So to define grammar I think we should pick Lezer package. It appears to be a standard way for code mirror to define lang grammars. So for example JSON with comments grammar may looks like this