vim-pico8-syntax
vim-pico8-syntax copied to clipboard
Please add support for the PICO-8 Shorthand `if`
PICO-8 supports a shorthand for if/then statements.
if (foo=="foo") then
x+=1
end
is the same as
if (foo=="foo") x+=1
When I use the shorthand, vim flags the next else or end as a mismatch. Unfortunately I'm new enough to vim to not understand the syntax files, but it would be awesome if this syntax file supported the shorthand.
I'm also not super familiar with writing syntax files, I'm unfortunately really sure the best way to fix this. The problem is that when there's a shorthand if, the region following is wrongly interpreted as the inside of the condition (because it goes from an if to a then), specified by this line.
I can sort of make the indenting work, but I'm not sure how to fix the else/end problem because the syntax seems weird to parse with just vim syntax files. I'll think about it a bit more but if you have any idea of the best way to fix it I'd be open to hearing it! I agree this should be fixed.
Thanks for the feedback. I'll look into it as well. I'll let you know if I come up with anything.