HarlemSquirrel / language-haml

Haml language grammar for GitHub's Atom IDE
MIT License
33 stars 24 forks source link

Adds support for if/else statements in haml without the "end" #67

Closed darrenterhune closed 7 years ago

darrenterhune commented 7 years ago

This has been bothering me for a while. But not enough to ever cause me to fix the problem. This does fix the problem of over-riding ruby's if statements although I'm not positive this is correct way to do it.

@pedantic-git to fix your issue quickly you can open your atom config folder and drop this into ~/.atom/snippets.cson or just the ~/.atom/packages/language-haml/snippets/language-haml.cson and when/if this gets merged or updated and merged it'll just over-ride and continue working.

@ezekg let me know if you'd like this fixed or changed?

refs #63

pedantic-git commented 7 years ago

Wow thanks! I'll give it a go tomorrow. My issue was with 'do'. Does this take care of that and all the other language constructs that have an 'end' like 'unless', 'while', etc? Apologies again for my ignorance about how snippets work.

darrenterhune commented 7 years ago

You can pretty much copy the code and replicate what's there for anything e.g. do, while, for. I'll wait on reply from @ezekg before I add anything else.

ezekg commented 7 years ago

This is great. I'd like to add support for do, while, for, etc. before merging.

darrenterhune commented 7 years ago

Sounds good, I'll get it added today when I have a minute. Is there anything else other than do, while and for that I'm not remembering?

pedantic-git commented 7 years ago

You can find them by searching for 'end' in the parent snippets: https://github.com/atom/language-ruby/blob/master/snippets/language-ruby.cson

I think these are all the remaining ones from the core language - I don't know if some of the other specialized ones that include a 'do' will also fire (e.g. 'Benchmark.bmbm do .. end'):

darrenterhune commented 7 years ago

I'm wondering why anyone would write begin, class, def, module etc in haml? I don't think those ones would be needed honestly.

pedantic-git commented 7 years ago

Maybe they're former PHP developers? ;)

Certainly would be unorthodox, but right now if someone does do it the snippet inserts an invalid 'end'.

ezekg commented 7 years ago

Awesome. I would go ahead and do all of them, just in case.

darrenterhune commented 7 years ago

K I've added everything my language-ruby package has that prints out end. If I missed anything, feel free to ping me in the future if you need help.

ezekg commented 7 years ago

Thanks a lot @darrenterhune. Cut v0.25 with the new snippets. 👌