Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript collapse-preserve-inline does not work #831

Closed
ttsirkia opened this issue Feb 26, 2016 · 8 comments
Closed

Javascript collapse-preserve-inline does not work #831

ttsirkia opened this issue Feb 26, 2016 · 8 comments
Assignees
Milestone

Comments

@ttsirkia
Copy link
Contributor

Description

The new option collapse-preserve-inlinefor Javascript does not work.

Expected Results

The beautified code should have looked like:

var a = {b: 4, c: 5};

Steps to Reproduce

  1. Add code to Atom editor
  2. Run command Atom Beautify: Beautify Editor
  3. This beautified code does not look right!

Debug

Here is a link to the debug.md Gist: https://gist.github.com/ttsirkia/ea5ec670aae96d6dedb1

@ttsirkia
Copy link
Contributor Author

And the result is the same with the version 0.28.24.

@ttsirkia
Copy link
Contributor Author

If I run js-beautify from command line, the result is the expected so it is not a bug in js-beautify (or at least it looks like that).

> node js-beautify.js -b collapse-preserve-inline test.js
var a = { b: 4, c: 5 };

@Glavin001
Copy link
Owner

There was a bug in 0.28.23 ( I pushed a feature I had not finished implementing by accident). Could you please update your debug.md with the latest version of Atom Beautify. Thank you!

Also it appears that the changes made by #779 are still available: https://github.com/Glavin001/atom-beautify/blob/master/src/languages/javascript.coffee#L75-L76

I believe the problem will be because of the bug (incomplete feature) I published. I apologize for this.

I see in your debug.md:

 "js": {
        "brace_style": "collapse-preserve-inline",

I recommend that you go into your Atom Beautify package settings again and find JavaScript - Brace Style, or set that instead in your .jsbeautifyrc.
The feature was regarding the re-organization of the settings and it is not complete. It appears that you have set one of the nested options, which was not working in 0.28.23 (not finished yet) and has been removed in 0.28.24, so you are still experiencing the issue.

This should resolve your problems. Let me know if it does not or if you have any more questions.

@Glavin001 Glavin001 added this to the v0.29.0 milestone Feb 26, 2016
@Glavin001 Glavin001 self-assigned this Feb 26, 2016
@ttsirkia
Copy link
Contributor Author

I already tried this with one computer this morning with the newest version and also changed the settings in the settings view. It didn't work.

Now I upgraded another computer to version 0.28.24 and with this computer it works. I try again with the first computer to see if there was some problems with the upgrade or something else. If there are not any new messages, then everything is fine. Thanks for your response!

@ttsirkia
Copy link
Contributor Author

Just to confirm, it works now also with the first computer. I deleted the plug-in second time but now the settings from config file as well and installed it again.

@Glavin001
Copy link
Owner

Sorry about that. I was working on a separate branch and I must have accidently merged it in because 1 stray commit screwed up all of the settings.

Glad to hear it is working now. I think you and other users will be pleased with the new settings organization once I have completed it 😃.

@ttsirkia
Copy link
Contributor Author

No problem. This is one of the best settings in Atom Beautify / JS-Beautify ever.

@thorstensson
Copy link

thorstensson commented Apr 12, 2018

Hello
Is there a way to not have JSX < > treated as brackets but as if they sat in HTML. First below is very readable:

  render(
    <Router>
         <Route path="/" component={Home}/>
    </Router>,
    document.getElementById(container)
  );

But after formatting (js beautify and prettydiff), I get this:

  render( <
    Router >
    <
    Route path = "/"
    component = {
      Home
    }
    /> <
    /Router>,
    document.getElementById(container)
  );

The last bit causes me to grab an extra cup of coffe . Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants