-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It starts from the wrong split #48
Comments
I've pushed a fix that should improve the situation. As long as you split from within the curly braces, it should work. This is still not optimal, since, if you try to split while on I'll see what I can do about fixing the ternary clause splitting. |
It splits now correctly if I put cursor on Is there a way to detect possible splits from the outside in? So it checks for a first |
It's not that easy, I'm afraid. If nothing else, this would be possible in some cases, but not in others, which means the different splittings would work in different positions. Right now, the rule of thumb is "be inside the structure you're splitting". Anything else is pretty complicated. To give you an example: method_call("Some long string") { |block| block.call } If you're in the block, this will split into method_call("Some long string") do |block|
block.call
end If you're in the string: method_call(<<-EOF) { |block| block.call }
Some long string
EOF However, if I were to implement "check for a curly brace after the cursor as well", the string would never be splittable in that position. |
But, as I said, it should not blow up like this. It should simply limit its splitting of ternary clauses. I'll see what I can do about that. |
After thinking about it, I guess you are right and it would be best if it just split at cursor position to avoid ambiguity and to have less "magic". |
Given:
After pressing
gS
I expect it would start from the outside and convert it to:Instead i get this, which is wrong and not even ruby:
The text was updated successfully, but these errors were encountered: