ohmjs / ohm-editor

An IDE for the Ohm language (JavaScript edition)
MIT License
96 stars 17 forks source link

Choosing grammar from multiple choices #50

Open ReFormationPro opened 2 years ago

ReFormationPro commented 2 years ago

When multiple grammars are present, editor picks the top most one. But if grammars inherit from each other, the derived one has to be lower. That means you cannot use a derived grammar on the editor. This will add a dropdown selector to select from grammars.

pdubroy commented 2 years ago

Thanks for this PR! I've had a chance to look at it and think a bit more deeply about how we should solve this. I think that ideally, the editor shouldn't assume that there's only one grammar. Instead, I'd rather put the grammar selection on each example, much like we do with the start rule.

I'll try to implement that in the coming days. In the meantime, if it unblocks you, you should be able to run your own branch locally via npm start now.