RobTheFiveNine / obsidian-gdscript

Adds live GDScript syntax highlighting to code blocks in the Obsidian editor.
Mozilla Public License 2.0
20 stars 0 forks source link

Feature Request: Language pack with Lezer #1

Open sh-cho opened 6 months ago

sh-cho commented 6 months ago

Maybe it's an overkill, but I think it's good to have parser based on Lezer Looks like gdscript lezer is implemented (https://www.npmjs.com/package/@gdquest/lezer-gdscript)

(ref: https://codemirror.net/examples/lang-package/)

RobTheFiveNine commented 6 months ago

I might look into this, as it looks like a much cleaner solution than using regex. Looking at that package (lezer-gdscript), it looks like it is missing quite a lot of stuff from GDScript, so I don't think that package would help replicate the current state of the plugin.

If I can get Lezer to handle some of the use cases where multiple steps of processing need to be carried out to do the highlighting (the stack pushing/popping part in the code) then I'll see if I can get it implemented, as it might help work around some of the limitations of CodeMirror's regex parsing (namely that you can't use the \b quantifier at the start of a pattern).