Eclipse Javascript formatter (ctrl-shift-f)
The problem can be solved by accessing
Preferences > JavaScript > Code Style > Formatter
Proceed:
- Create a new profile (since you cannot edit the builted-in one), if you haven't already, and click
Edit...
. - Open the
Line Wrapping
tab. - In the
Maximum line width
field, enter 9999. - Click
Apply
, andOk
.
The problem shows up again for code lines that have more than 9999 characters, but I can live with that.
From my experience, it is the long, unbreakable lines that cause this problem. Very irritating. Try putting the long string constants (like "'CREATE TABLE IF NOT EXISTS calendar(id UNIQUE, summary, description, location, startdate, enddate)'") into a separate var, or if it really bugs you, you could break it apart and concat with +.
I tried this:
function buildDatabase() { var sql1 = 'CREATE TABLE IF NOT EXISTS calendar(id UNIQUE, summary, description, location, startdate, enddate)'; db.transaction(function(tx) { tx.executeSql('DROP TABLE IF EXISTS calendar'); tx.executeSql(sql1); }, function(err) { document.querySelector('#debugLog').innerHTML += '<p><code>' + err.message + '</code></p>'; });}
Preferences > JavaScript > Code Style > Formatter > Line Wrapping (tab)
uncheck >> prefer wrapping outer expressions (keep nested expression on one line)