Closed jclusso closed 8 years ago
I've recently merged in a couple of pull requests, did that fix this for anyone?
Nope. @cannikin, you gotta merge #22 which fixes a lot of things with multiline support. This however still is not resolved there as of last I checked.
Okay, watch to check out my master and make sure it works? GitHub was telling me it couldn't be automatically merged via pull request but when I did it locally it worked just fine, so I hope I didn't break something!
If it looks good then I'll release an official version.
Appears to fix everything but the ruby lines now.
I tried to fix the ruby lines myself but I was struggling and it looked like @richrace was doing a good job on the other stuff. Maybe he can figure it out. My regex skills are weak and I have little experience writing these language files.
Right, for the multiline ruby code it's a bit complicated and not sure how to go about getting it to work.
Basically I have this regex: ((do|\{)( \|[^|]+\|)?)$|((\w|\}|"|\'|\))\s*(\|?)$)
which when tested on these strings:
= link_to_remote "Add to cart",
:url => { :action => "add", :id => product.id },
:update => { :success => "cart", :failure => "error" }
.div
= link_to_remote "Add to cart"
.div
= link_to_remote 'Add to cart'
.div
= link object
.div
= render(object,
:template => "Test"
)
.div
= link_to_remote "Add to cart", |
:url => { :action => "add", :id => product.id }, |
:update => { :success => "cart", :failure => "error" } |
.div
= link_to_remote "Add to cart", |
:url => { :action => "add", :id => product.id }, |
:update => "test" |
.div
Should get the last terminator, and I believe it should go on this line: https://github.com/cannikin/language-haml/blob/master/grammars/ruby%20haml.cson#L207
However, I can't get it to work for all instances. For example, it works with the pipe terminators, but if you remove them then it breaks the rest of the formatting until there is a pipe.
I hope this helps you @jclusso and others :)
(This is the properly escaped regex for Atom: ((do|\\{)( \\|[^|]+\\|)?)$|((\\w|\\}|"|\'|\\))\\s*(\\|?)$)
)
@richrace, this is for vim but tpope is a vim boss and his works :) https://github.com/tpope/vim-haml/blob/master/syntax/haml.vim Maybe you can get some ideas from that?
Either way, I'm gonna get my buddy who is much better at regex to help me look it. I'll update later tonight when I get a chance to play around with this.
Seems like the TextMate bundle, which this is based off, is having the same issue: https://github.com/textmate/ruby-haml.tmbundle/issues/9
@richrace textmate and sublime both are broken on this functionality unfortunately :(
I was unable to make any progress. Anyone else have any luck?
I found a problem with end of attributes '}' regex it works wrong when I'm using hashes inside attributes
Just created PR to fix it
@iRet do you have any idea how to fix the ruby syntax?
@jclusso oh, haven't seen it yet, let me try
@iRet if you fix that I'll be so happy :)! I gave up and I think @richrace did to because we both couldn't figure it out.
@jclusso just fixed ruby strings and updated PR
Still see some issues with html tags but that's enough for today :) will dig it later
Awesome, @iRet! I'll try it out and see how it works
@jclusso sorry but it still buggy. Actually I can figure it out for sublime haml package, it's pretty same ported textmate bundle with a minor changes, but python regexp support negative lookahead, so we can say 'end of line but not prepended with comma'. Will try again this weekends.
@iRet cool! I appreciate you trying to fix this
@iRet did you ever get the ruby line working?
Anything mergeable or we still looking at fixes?
@jclusso not fully, actually attributes and ruby lines looks ok now, but it caused new issues with haml/html tags
Still had no time for a deeper look into it. And switched to sublime, where I'm using similar fixes but it not causes this tags bug.
I've just updated updated my PR if you interested in testing, another things seems fine as far as I tested.
It seems like problem not in rubyline end pattern, just tried to add quotes to it, no effect. And tags higlighted as text not as ruby code. It could be in html tag start pattern, but it is almost the same like in sublime package, so weird.
Yea, idk if it's of any use but I linked above to a working syntax highlighter for vim written by tpope. I'm not well enough versed to pick the regex apart or i'd do it myself. @iRet
https://github.com/tpope/vim-haml/blob/master/syntax/haml.vim
Anyone still working on this? This is still an issue in 0.21.0
.
Sorry, I was supposed to be transferring ownership of this to someone who had the time to devote to maintaining it. @ezekg offered to take it over a few months ago but I dropped the ball. Anyone else?
@cannikin, if needed, I would like to help out with this still. I use this package every day.
Great! Any idea what steps we go through to transfer ownership? Moving the repo should be easy? But I don't know about the APM package...
I'm not entirely sure. I've never done that. I can look into it later today, though.
As far as I can tell, I think I have this issue resolved by rewriting the ruby haml.cson
file (essentially just copying the current Sublime text implementation), and cleaning up a couple regexes (adding a little recursion for commas/blocks). I'll post it here soon and see if we can get a new version out to test.
When this issue is fixed, I want to start work on a PHP Haml grammar. I'll also need people to test the Coffee Haml, because I've never used that.
I'd be down to help out once @ezekg takes over.
This is how you transfer ownership: https://atom.io/docs/latest/behind-atom-maintaining-your-packages#transferring-ownership
Great! Transfer initiated! Apparently you just transfer ownership of the repo and the package will magically go over as well.
I think I have everything working nicely. Still a couple issues with filters and trimmed whitespace, but nothing huge. Looking good. I'll continue to test this week before creating a new beta version. :+1:
Anything I should know about going package releases? Does it go by tagged releases?
Nice that this finally looks to be getting fixed! Too bad we've started a heavy migration to Slim since Haml is just not nearly as fast. :(
@ezekg More :cake: for you!
Everybody test out the new version (0.22.0
). Let me know if you find any new issues or edge cases I missed. I'm going to close this issue until told otherwise. :ok_hand:
multiline code highlighting doesn't work in ruby haml.