Support multiline strings (ex in coffee) #7

Closed
ichernev opened this Issue Apr 6, 2012 · 4 comments

Projects

None yet

2 participants

@ichernev
ichernev commented Apr 6, 2012
foo = """
  ala bala
"""

and

foo = "ala bala"
@AndrewRadev
Owner

That would be pretty useful. I'll see what I can do about it this weekend.

@AndrewRadev
Owner

The latest version now supports multiline strings in coffee. I'll see about adding support in other filetypes further down the line.

@AndrewRadev AndrewRadev closed this Apr 8, 2012
@ichernev

I'm not sure if it is working as expected.
If you have foo = "bar" and the cursor is in the beginning of the line, it doesn't split. The cursor should be inside the string for it to work.

@AndrewRadev
Owner

Yeah, that's intended. Consider this:

foo = "bar" if baz?

This could either split the if clause or the string. Of course, it makes sense to prioritize the if clause in this case, but how about this one:

foo = bar "baz", "qux"

Now there's two strings. Which one to split? The second one makes more sense, but it's getting a bit ambiguous here. I could add some additional logic to look for the construct "closest" to the cursor, but that's going to be complicated to implement. I'd rather have the rule "be inside the construct in order to split it".

Incidentally, the recently implemented ternary operator splitting may cause some problems in this regard, but I'll work on that some more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment