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

Can't get .jsbeautifyrc to work on windows. #236

Closed
elebetsamer opened this issue Mar 16, 2015 · 14 comments
Closed

Can't get .jsbeautifyrc to work on windows. #236

elebetsamer opened this issue Mar 16, 2015 · 14 comments
Assignees

Comments

@elebetsamer
Copy link

I'm running Atom on windows and trying to use a .jsbeautifyrc file in the root of my project, but no matter what I have tried, it just doesn't seem to work. Or maybe I'm just not understanding how it works. I've tried the json format and also the yaml format. Has this been tested on windows? Is there something I am missing about how to get this to work?

@Glavin001
Copy link
Owner

Has this been tested on windows?

I do not have a Windows computer to test on (Mac has been tested).
However since it's using all of the Node.js APIs, it should work just fine.

What is your .jsbeautifyrc contents? And how do you know it is not working? For instance, do you have a file you are testing and have an expected output. Does beautification work at all? Is it beautifying but simply not respectiving your .jsbeautifyrc?

Also what version of Atom and Atom Beautify do you have.

@Glavin001 Glavin001 added the bug label Mar 16, 2015
@Glavin001 Glavin001 self-assigned this Mar 16, 2015
@elebetsamer
Copy link
Author

My Atom is version 0.187.0. My version of atom-beautify is 0.21.6.

This is my .jsbeautifyrc file:

{
  "css": {
    "selector_separator_newline": true,
    "newline_between_rules": true
  },
  "js": {
    "break_chained_methods": true
    "end_with_newline": true
    "space_after_anon_function": true
  }
}

I've tested with a few javascript files and some scss files (assuming this will still work with the css rules). For javascript, I would assume that this code:

angular
    .module('myApp.controllers').controller(

Would get beautified to:

angular
    .module('myApp.controllers')
    .controller(

But it just leaves it the way it already is. I would also assume this code $scope.doStuff = function() { would get beautified to $scope.doStuff = function () {. But again, it doesn't make the change.

For my scss file, it goes from this:

hr {
  border: 0;
}

.bar.nav-bar-primary,
.bar.nav-bar-secondary {
  box-shadow: 0 0 5px rgba(0, 0, 0, .5);
}

To this:

hr {
  border: 0;
}
.bar.nav-bar-primary, .bar.nav-bar-secondary {
  box-shadow: 0 0 5px rgba(0, 0, 0, .5);
}

So in that case it doesn't seem to respect my rules either. So, either I'm totally misunderstanding how to use this, or it just doesn't seem to work.

@Glavin001
Copy link
Owner

I am going to work on #237 which will help with diagnosing this and other issues.

@elebetsamer
Copy link
Author

Sounds good. Thanks for being so responsive.

@Glavin001
Copy link
Owner

I published the new Debug Command to v0.22.0
Please update Atom Beautify and the run the Beautify: Debug command from either the command palette or from the menu, Packages -> Atom Beautify -> Debug. Follow the instructions and paste your debug information here. As it mentions, be sure to give it a look over before sending to make sure you are comfortable with what it is sharing.

@elebetsamer
Copy link
Author

When running the debug, I get an error:

Error

@elebetsamer
Copy link
Author

Here is the full error report.

Atom Version: 0.187.0
System: Microsoft Windows 8.1 Pro
Thrown From: atom-beautify package, v0.22.2

Stack Trace

Uncaught ReferenceError: showError is not defined

At C:\Users\Eric\.atom\packages\atom-beautify\lib\beautify.coffee:250

ReferenceError: showError is not defined
  at atom-workspace.debug (C:\Users\Eric\.atom\packages\atom-beautify\lib\beautify.coffee:250:16)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Eric\AppData\Local\atom\app-0.187.0\resources\app\src\command-registry.js:246:29)
  at CommandRegistry.handleCommandEvent (C:\Users\Eric\AppData\Local\atom\app-0.187.0\resources\app\src\command-registry.js:3:61)
  at CommandRegistry.module.exports.CommandRegistry.dispatch (C:\Users\Eric\AppData\Local\atom\app-0.187.0\resources\app\src\command-registry.js:159:19)
  at EventEmitter.<anonymous> (C:\Users\Eric\AppData\Local\atom\app-0.187.0\resources\app\src\window-event-handler.js:75:30)
  at EventEmitter.emit (events.js:116:17)

Commands

     -0:10.3 beautify:debug (div.settings-view.pane-item)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "atom-monokai"
    ],
    "disabledPackages": [
      "autocomplete-paths",
      "emmet",
      "autocomplete-plus",
      "autocomplete-snippets"
    ]
  },
  "atom-beautify": {
    "_analyticsUserId": "7754683f-f9d7-45f1-86d4-b7060a1f332f"
  }
}

Installed Packages

# User
angularjs, v0.1.0
atom-beautify, v0.22.2
atom-monokai, v0.6.0
color-picker, v1.4.4
editorconfig, v0.3.2
grunt-runner, v0.7.0
highlight-line, v0.10.1
ionic-atom, v0.3.1
language-aspx, v0.2.0
language-csharp, v0.5.0
language-ejs, v0.1.0
language-jade, v0.3.0
language-powershell, v2.0.0
open-recent, v2.2.0

# Dev
No dev packages

@Glavin001
Copy link
Owner

Yes there is a bug at https://github.com/Glavin001/atom-beautify/blob/master/lib/beautify.coffee#L249-L251
It occurs when you do not have an editor selected.
Please select an editor tab for the file you are trying to beautify and run Beautify: Debug again.

@Glavin001
Copy link
Owner

Published fix for Debug command to v0.22.3

@elebetsamer
Copy link
Author

Here is the debug output. My .jsbeautifyrc file is in the root of my project, which is H:\Development\myApp\myApp-ionic

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Mon Mar 16 2015 14:31:30 GMT-0700 (Pacific Daylight Time).


Platform: win32

Versions

Atom Version: 0.187.0

Atom Beautify Version: 0.22.3

Original file to be beautified

Original File Path: H:\Development\myApp\myApp-ionic\www\app\components\driver\startController.js

Original File Grammar: JavaScript

Original File Contents:

(function() {
  "use strict";

  angular
    .module('myApp.controllers')
    .controller('DriverStartController', ['$scope', '$rootScope', 'PubNub', 'PUBNUBCONFIG', function($scope, $rootScope, PubNub, PUBNUBCONFIG) {
      $scope.readyToDrive = false;

      $scope.readyToDriveChanged = function() {

      };
    }]);
}());

Beautification options

Editor Options:
Options from Atom Editor settings

{
    "indent_size": 2,
    "indent_char": " ",
    "indent_with_tabs": false
}

Config Options:
Options from Atom Beautify package settings

{
    "js": {
        "indent_size": 2,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "css": {
        "indent_size": 2,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false
    },
    "html": {
        "htmlbeautifier_path": "",
        "indent_inner_html": false,
        "indent_size": 2,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 2,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "sql": {
        "indent_size": 2,
        "keywords": "upper",
        "identifiers": "lower",
        "sqlformat_path": ""
    },
    "markdown": {
        "pandoc_path": "",
        "yaml_front_matter": true
    },
    "perl": {
        "perltidy_path": "perltidy",
        "perltidy_profile": ""
    },
    "php": {
        "beautifier_path": "",
        "filters": "",
        "directory_filters": ""
    },
    "python": {
        "autopep8_path": "",
        "max_line_length": 79,
        "indent_size": 2,
        "ignore": [
            "E24"
        ]
    },
    "ruby": {
        "rbeautify_path": ""
    },
    "c": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cpp": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "objectivec": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cs": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "d": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "java": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "pawn": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "vala": {
        "uncrustifyPath": "",
        "configPath": ""
    }
}

Home Options:
Options from H:\Users\Eric\.jsbeautifyrc

{}

EditorConfig Options:
Options from EditorConfig file

{
    "charset": "utf-8",
    "end_of_line": "lf",
    "indent_size": 2,
    "indent_style": "space",
    "insert_final_newline": true,
    "trim_trailing_whitespace": true,
    "tab_width": 2,
    "indent_char": " "
}

Project Options:
Options from .jsbeautifyrc files starting from directory H:\Development\myApp\myApp-ionic\www\app\components\driver and going up to root

[
    {},
    {},
    {},
    {},
    {},
    {},
    {}
]

Logs

Error logs: Not yet supported

@Glavin001
Copy link
Owner

So it is definitely not loading your file however it should be passing over it on its way up from your file path to root. 

You have put it in the correct place though.

What is the contents of your .jsbeautifyrc file?


Sent from Mailbox

On Mon, Mar 16, 2015 at 6:40 PM, Eric Lebetsamer [email protected]
wrote:

Here is the debug output. My .jsbeautifyrc file is in the root of my project, which is H:\Development\myApp\myApp-ionic

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Mon Mar 16 2015 14:31:30 GMT-0700 (Pacific Daylight Time).

Platform: win32

Versions

Atom Version: 0.187.0
Atom Beautify Version: 0.22.3

Original file to be beautified

Original File Path: H:\Development\myApp\myApp-ionic\www\app\components\driver\startController.js
Original File Grammar: JavaScript
Original File Contents:

(function() {
  "use strict";
  angular
    .module('myApp.controllers')
    .controller('DriverStartController', ['$scope', '$rootScope', 'PubNub', 'PUBNUBCONFIG', function($scope, $rootScope, PubNub, PUBNUBCONFIG) {
      $scope.readyToDrive = false;
      $scope.readyToDriveChanged = function() {
      };
    }]);
}());

Beautification options

Editor Options:
Options from Atom Editor settings

{
    "indent_size": 2,
    "indent_char": " ",
    "indent_with_tabs": false
}

Config Options:
Options from Atom Beautify package settings

{
    "js": {
        "indent_size": 2,
        "indent_char": " ",
        "indent_level": 0,
        "indent_with_tabs": false,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "space_in_paren": false,
        "jslint_happy": false,
        "space_after_anon_function": false,
        "brace_style": "collapse",
        "break_chained_methods": false,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "space_before_conditional": true,
        "eval_code": false,
        "unescape_strings": false,
        "wrap_line_length": 0,
        "end_with_newline": false
    },
    "css": {
        "indent_size": 2,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false
    },
    "html": {
        "htmlbeautifier_path": "",
        "indent_inner_html": false,
        "indent_size": 2,
        "indent_char": " ",
        "brace_style": "collapse",
        "indent_scripts": "normal",
        "wrap_line_length": 250,
        "wrap_attributes": "auto",
        "wrap_attributes_indent_size": 2,
        "preserve_newlines": true,
        "max_preserve_newlines": 10,
        "unformatted": [
            "a",
            "sub",
            "sup",
            "b",
            "i",
            "u"
        ],
        "end_with_newline": false
    },
    "sql": {
        "indent_size": 2,
        "keywords": "upper",
        "identifiers": "lower",
        "sqlformat_path": ""
    },
    "markdown": {
        "pandoc_path": "",
        "yaml_front_matter": true
    },
    "perl": {
        "perltidy_path": "perltidy",
        "perltidy_profile": ""
    },
    "php": {
        "beautifier_path": "",
        "filters": "",
        "directory_filters": ""
    },
    "python": {
        "autopep8_path": "",
        "max_line_length": 79,
        "indent_size": 2,
        "ignore": [
            "E24"
        ]
    },
    "ruby": {
        "rbeautify_path": ""
    },
    "c": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cpp": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "objectivec": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "cs": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "d": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "java": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "pawn": {
        "uncrustifyPath": "",
        "configPath": ""
    },
    "vala": {
        "uncrustifyPath": "",
        "configPath": ""
    }
}

Home Options:
Options from H:\Users\Eric\.jsbeautifyrc

{}

EditorConfig Options:
Options from EditorConfig file

{
    "charset": "utf-8",
    "end_of_line": "lf",
    "indent_size": 2,
    "indent_style": "space",
    "insert_final_newline": true,
    "trim_trailing_whitespace": true,
    "tab_width": 2,
    "indent_char": " "
}

Project Options:
Options from .jsbeautifyrc files starting from directory H:\Development\myApp\myApp-ionic\www\app\components\driver and going up to root

[
    {},
    {},
    {},
    {},
    {},
    {},
    {}
]

Logs

Error logs: Not yet supported

Reply to this email directly or view it on GitHub:
#236 (comment)

@elebetsamer
Copy link
Author

Ok, I feel like a total idiot now, but I had mixed json and the yaml format in the file. Totally user error, so sorry for wasting your time on this one. I guess as an upside, you've added some debug code that might come in handy in the future, lol.

@elebetsamer
Copy link
Author

Oh, I will say though, that the newline_between_rules css rule doesn't seem to work on my scss file.

@Glavin001
Copy link
Owner

Oh, I will say though, that the newline_between_rules css rule doesn't seem to work on my scss file.

Feel free to create another issue and we can look into that.

Ok, I feel like a total idiot now, but I had mixed json and the yaml format in the file. Totally user error, so sorry for wasting your time on this one. I guess as an upside, you've added some debug code that might come in handy in the future, lol.

No worries, I had a feeling that was the case anyway 😉. It is always good to go through the steps just to be sure. I hope to add even more debugging that will make simple issues like this very clear and quick to resolve.

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