linux-china / jetbrains-just-plugin

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

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

Closed timlyo closed 2 months 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 1 year 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
linux-china commented 2 months ago

Lex rewrite with version 0.5.2, please check it.

timlyo commented 2 months ago

Just updated, looks like it's fixed. Thankyou.

image