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

Option default_beautifier not respected #1570

Closed
adi518 opened this issue Mar 29, 2017 · 3 comments
Closed

Option default_beautifier not respected #1570

adi518 opened this issue Mar 29, 2017 · 3 comments
Assignees

Comments

@adi518
Copy link

adi518 commented Mar 29, 2017

Description

Started editing JSX files lately so the package now defaults to Pretty Diff. Strange actually, because JS Beautify seems more elaborate/popular. Since a lot of my legacy project was formatted using JS Beautify I'm bound to keep using it anyway, so I set .jsbeautifyrc with default_beautifier: JS Beautify, expecting it'd work.

Input Before Beautification

This is what the code looked like before:

switch (1) {
case 1:
    break;
}

Expected Output

The beautified code should have looked like this:

switch (1) {
case 1:
    break;
}

Actual Output

The beautified code actually looked like this:

switch (1) {
    case 1:
        break;
}

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/adi518/310db275bf1270e7d2a0eb39d9b428ed

Checklist

I have:

  • [x ] Tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
  • [x ] Reloaded (or restarted) Atom to ensure it is not a caching issue
  • [ x] Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
    so I know this is not a duplicate issue
  • [x ] Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
  • [ x] Generated debugging information by executing Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issue
@Glavin001
Copy link
Owner

If I recall correctly, Pretty Diff beautifier ( @prettydiff ) has better support for JSX than JS Beautify, thus the defaultBeautifier for JSX is set to Pretty Diff: https://github.com/Glavin001/atom-beautify/blob/master/src/languages/jsx.coffee#L25

I think you are correct, the default_beautifier option is not respected from the configuration files (e.g. .jsbeautifyrc). I see it is being extracted from Atom's settings:

preferredBeautifierName = atom.config.get("atom-beautify.#{language.namespace}.default_beautifier")

I will be addressing this bug in future releases with Unibeautify ( #1174 ) which will rely on configuration and not on Atom's settings for default_beautifier and more. For now, I recommend you make the change within Atom-Beautify's package settings.

@Glavin001 Glavin001 added the bug label Apr 9, 2017
@Glavin001 Glavin001 self-assigned this Apr 9, 2017
@stale
Copy link

stale bot commented Nov 4, 2017

This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 4, 2017
@stale stale bot closed this as completed Nov 11, 2017
@Glavin001 Glavin001 reopened this Mar 2, 2018
@stale stale bot removed the stale label Mar 2, 2018
@stale
Copy link

stale bot commented May 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 1, 2018
@stale stale bot closed this as completed May 8, 2018
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

2 participants