gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

Autoformat breaks code for comments #391

Closed derwaldgeist closed 7 years ago

derwaldgeist commented 7 years ago

I am using language-babel in combination with atom-beautify.

In adapter.js, there is the following lines:

  // add promise support
  ['createOffer', 'createAnswer'].forEach(function(method) {
  ...

If I enable language-babel, this is auto-beautified on save to:

  // add promise support['createOffer', 'createAnswer'].forEach(function(method) {
  ...

effectively breaking the code.

gandm commented 7 years ago

You should raise this issue at the beautify repo as I don't format code.


From: Tom Brücknermailto:notifications@github.com Sent: ‎30/‎07/‎2017 14:53 To: gandm/language-babelmailto:language-babel@noreply.github.com Cc: Subscribedmailto:subscribed@noreply.github.com Subject: [gandm/language-babel] Autoformat breaks code for comments (#391)

I am using language-babel in combination with atom-beautify.

In adapter.js, there is the following lines:

// add promise support ['createOffer', 'createAnswer'].forEach(function(method) { ...

If I enable language-babel, this is auto-beautified to:

// add promise support['createOffer', 'createAnswer'].forEach(function(method) { ...

effectively breaking the code.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gandm/language-babel/issues/391, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACNMFZTs6wBpfKkZm6jRhAsKxMFpBlwDks5sTIregaJpZM4OnpCs.

derwaldgeist commented 7 years ago

So you think it's not related to the babel package? Strange thing is: it works if I disable this package.

gandm commented 7 years ago

Yes I think it is the beautifier. The actual beautifier used depends on the scope of the grammar used. My scope is source.js.jsx therefore a jsx beautifier is used. If you use the atom JavaScript grammar it uses source.js and maybe another beautifier.


From: Tom Brücknermailto:notifications@github.com Sent: ‎30/‎07/‎2017 15:25 To: gandm/language-babelmailto:language-babel@noreply.github.com Cc: Grahammailto:gandmclark@gmail.com; Commentmailto:comment@noreply.github.com Subject: Re: [gandm/language-babel] Autoformat breaks code for comments (#391)

So you think it's not related to the babel package? Strange thing is: it works if I disable this package.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/gandm/language-babel/issues/391#issuecomment-318905117, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACNMFcQihUdDmo_K1Mx7xEnloj4f8Ib6ks5sTJItgaJpZM4OnpCs.

gandm commented 7 years ago

From the atom-beautify readme that shows the default beautifiers used.. image

derwaldgeist commented 7 years ago

Ok, thanks, I filed an issue there.