pombreda / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

Use \ instead of concatenation for multi-line strings #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When pressing <Enter> inside a string literal, js2-mode currently uses 
string concatenation to create a new line:

var x = 'first line'
    + 'second line';

It would be better - in terms of number of characters, readability and 
performance - to use a backspace to escape the new line instead:

var x = 'first line\
second line';

Original issue reported on code.google.com by stef...@gmail.com on 4 Apr 2008 at 1:35

GoogleCodeExporter commented 9 years ago
I agree that it'd be nicer, but I can also see cases where you want to indent 
the 2nd line. So I'd vote for one 
default behavior and another key binding for the second.

Original comment by Rae...@gmail.com on 4 Apr 2008 at 5:26

GoogleCodeExporter commented 9 years ago
I can add an option for this.

Performance:  not an issue.  SpiderMonkey and Rhino both collapse string literal
concatenations into a single string literal during parsing.

Original comment by steve.ye...@gmail.com on 14 Apr 2008 at 10:11

GoogleCodeExporter commented 9 years ago

Original comment by steve.ye...@gmail.com on 16 Apr 2008 at 9:44

GoogleCodeExporter commented 9 years ago
Here's an attempt at a patch. I haven't written all that much Elisp before, so 
it'll
need a once-over before inclusion, I expect. It's pretty simple though.

Original comment by dmho...@gmail.com on 18 Jul 2008 at 7:11

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by steve.ye...@gmail.com on 23 Jul 2009 at 11:41