Open dgtized opened 10 years ago
Right, better handling of parenthesis is on my todo list. Right now it's still relying on smartparens default behaviour for them, which is not correct (slurping and barfing only work in trivial cases).
This might take a while before I look into it though, with the holiday season and so on...
Should be simple enough to repurpose sp--unwrap-sexp
to take optional opening/closing replacement---right now it only deletes the regions occupied by the delimiters.
I'm thinking what would be a good way to specify the replacements though. I suppose it'll need a customize variable. Or maybe a pair property if the replacement with spaces isn't always correct.
So that's the question on you: is it always valid to replace the parens with spaces? Can't there be a construct where it would not make sense in ruby?
Though I think that having it as pair property would be more flexible for the future anyway.
I'd say that would be a very useful feature that would simplify the rest of the ruby config (which is already way too much complex :p)
If you can make it so that the parenthesis is replaced by "just one space", that would be super perfect and work everywhere. Bonus if it can be smart about end of line (i.e. no extra space at the end of the line).
What about other types of parens as @dgtized mentioned? I think I'll make it a pair property where you can specify a cons of beg/end replacements... with some special form with tests if the replacement should occur or not.
Currently if you hit
M-s
in the middle of the code below it transforms fromGiven that parentheses are optional in ruby I would expect the default transformation to leave a space where at least the beginning parentheses is to avoid joining words together. I would expect the behavior to be
I don't know if this should also apply to single quotes or strings or other braces.