Eclipse Javascript formatter (ctrl-shift-f)

前端 未结 5 1700
北恋
北恋 2021-02-02 09:38

I don\'t like asking this question but I have honestly been looking for a way to figure this out for a very long time.

This is a simple question. I have been using NetBe

5条回答
  •  日久生厌
    2021-02-02 10:23

    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 += '

    ' + err.message + '

    '; }); }

提交回复
热议问题