justinj / vim-pico8-syntax

Syntax file for Pico-8
62 stars 13 forks source link

Please add support for the PICO-8 Shorthand `if` #4

Open JakeCarter opened 7 years ago

JakeCarter commented 7 years ago

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.

justinj commented 7 years ago

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.

JakeCarter commented 7 years ago

Thanks for the feedback. I'll look into it as well. I'll let you know if I come up with anything.