RobTheFiveNine / obsidian-gdscript

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

Method names being invoked on an object are not highlighted as functions #3

Open RobTheFiveNine opened 3 months ago

RobTheFiveNine commented 3 months ago

Example code that can replicate the bug:

var item = inventory.equipped_item
inventory.remove_item(item)
RobTheFiveNine commented 3 months ago

This might need a rework of how the parsing works. The simple mode definition of CodeMirror (https://codemirror.net/5/demo/simplemode.html) might not be extensive enough to handle this.

The challenge with implementing this is going to be that the opening bracket needs to be detected to know a function is being invoked, but then that will mean the bracket will have the same token applied as the name of the function.

The next option seemed like it may have worked, but it doesn't pass the initial match into the next mode.

It looks like the backUp function in the API mode may help with implementing this though: https://codemirror.net/5/doc/manual.html#modeapi