linux-china / jetbrains-just-plugin

JetBrains Just Command Runner Plugin
https://plugins.jetbrains.com/plugin/18658-just
Apache License 2.0
35 stars 6 forks source link

If/Else blocks without spaces surrounding commands aren't highlighted correctly #12

Open timlyo opened 1 year ago

timlyo commented 1 year ago

I've noticed that missing spaces around if/else blocks cause the rest of the file to not be parsed correctly. I've done some experimenting with the line that breaks it and found a minimal setup that replicates, as shown in the image.

image

I'm on PyCharm 2023.1.3 and using plugin version 0.3.6.

Here's the above in text in case it helps to replicate

thingy := if `true` { `ls` } else { "ls" }
thingy := if `true` {`ls` } else { "ls" }
thingy := if `true` { `ls` } else { "ls"}
thingy := if `true` {`ls`} else {"ls"}
# also not highlighted until next valid block
thingy := if `true` {`ls` } else { "ls" }
# Is highlighted
linux-china commented 8 months ago

@timlyo it was caused by Flex during token analysis. Now it's hard for me to fix this problem, and I should rewrite flex logic for this case. Now you should add space, and sorry for this trouble.

thingy := if `true` { `ls` } else { "ls" }
thingy := if `true` { `ls` } else { "ls" }
thingy := if `true` { `ls` } else { "ls" }
thingy := if `true` { `ls` } else { "ls" }
# also not highlighted until next valid block
thingy := if `true` { `ls` } else { "ls" }
# Is highlighted