My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 18: Use \ instead of concatenation for multi-line strings
3 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  steve.ye...@gmail.com


Sign in to add a comment
 
Reported by stef...@gmail.com, Apr 4, 2008
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';

Apr 4, 2008
#1 Rae...@gmail.com
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.
Apr 14, 2008
Project Member #2 steve.ye...@gmail.com
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.
Status: Accepted
Owner: steve.yegge
Apr 16, 2008
Project Member #3 steve.ye...@gmail.com
(No comment was entered for this change.)
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low
Jul 18, 2008
#4 dmho...@gmail.com
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.
backslash-for-string-split.diff
2.8 KB   View   Download
Jul 23, 2009
Project Member #5 steve.ye...@gmail.com
(No comment was entered for this change.)
Labels: -Priority-Low Priority-Medium
Sign in to add a comment

Powered by Google Project Hosting