Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 258858

Summary: Reformatting ES6 object deletes empty rows
Product: javascript Reporter: dusty <dusty>
Component: Formatting & IndentationAssignee: Petr Hejl <phejl>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3    
Version: 8.2   
Target Milestone: 8.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Issue Type: DEFECT Exception Report:
Bug Depends on:    
Bug Blocks: 242387    

Description dusty 2016-04-15 15:15:49 UTC
If I have a code similar to this one:

export default Ember.Route.extend({

  x1: Ember.inject.service('myserv'),
  x2: "noname",

  redirect (mode, transition) {
    this.transitionTo("console.dashboard")
  },

  actions: {

    gotoDbStats() {
      this.transitionTo("console.global-stats")
    },

    getMydata1() {
      this.get('cm').getOpenSessions().then( x => {
        // Do something
        return x
      })
    },

    signOut() {
      const cm = this.get('cm')
      cm.walletClose().then( () =>
        window.location.replace('/')
      )
    }
  }

get reformatted this way, deleting all empty rows:

export default Ember.Route.extend({
  x1: Ember.inject.service('myserv'),
  x2: "noname",
  redirect(mode, transition) {
    this.transitionTo("console.dashboard")
  },
  actions: {
    gotoDbStats() {
      this.transitionTo("console.global-stats")
    },
    getMydata1() {
      this.get('cm').getOpenSessions().then(x => {
        // Do something
        return x
      })
    },
    signOut() {
      const cm = this.get('cm')
      cm.walletClose().then(() =>
              window.location.replace('/')
              )
    }
  }
}
Comment 1 dusty 2016-04-15 15:16:17 UTC
also, the indenting of signOut is less then optimal IMHO
Comment 2 Petr Hejl 2016-04-18 08:33:14 UTC
Except the arrow function formatting this does not seem to be ES6 specific.
Comment 3 dusty 2016-04-18 08:43:15 UTC
There are also the function definitions in ES6 style.

But you are right: the problem is there also when editing old JS code, I didn't notice before.
Comment 4 Petr Hejl 2016-04-28 14:34:55 UTC
Empty row preservation is now configurable - web-main a16756d7232a.
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo