Glavin001 / atom-beautify

:mega: Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | :lipstick: Universal beautification package for Atom editor (:warning: Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding :heart: )
http://unibeautify.com/
MIT License
1.5k stars 454 forks source link

end_with_newline not being read from ~/.atom/packages/atom-beautify/.jsbeautifyrc #256

Closed mpmeyer closed 9 years ago

mpmeyer commented 9 years ago

When I set "end_with_newline": "true" in the atom package's, .jsbeautifyrc, it appears to be ignored.

If I set it in my home directory, .jsbeautifyrc, then it seems to work.

Thanks,

Glavin001 commented 9 years ago

Please run Atom Beautify - Help Debug Editor

mpmeyer commented 9 years ago

Atom Beautify - Debugging information

The following debugging information was generated by Atom Beautify on Sat May 09 2015 10:43:22 GMT-0700 (PDT).


Platform: darwin

Versions

Atom Version: 0.198.0

Atom Beautify Version: 0.27.1

Original file to be beautified

Original File Path: /Users/mmeyer/projects/testit.js

Original File Grammar: JavaScript

Original File Contents:

function testit() {
  var one = 1;
  var two = 2
}

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

{
    "cs": {
        "configPath": ""
    },
    "c": {
        "configPath": ""
    },
    "cpp": {
        "configPath": ""
    },
    "css": {
        "indent_size": 2,
        "indent_char": " ",
        "selector_separator_newline": false,
        "newline_between_rules": false,
        "preserve_newlines": false
    },
    "d": {
        "configPath": ""
    },
    "html": {
        "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
    },
    "java": {
        "configPath": ""
    },
    "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
    },
    "objectivec": {
        "configPath": ""
    },
    "pawn": {
        "configPath": ""
    },
    "perl": {
        "perltidy_profile": ""
    },
    "php": {
        "fixers": "",
        "level": ""
    },
    "python": {
        "max_line_length": 79,
        "indent_size": 2,
        "ignore": [
            "E24"
        ]
    },
    "sql": {
        "indent_size": 2,
        "keywords": "upper",
        "identifiers": "lower"
    },
    "vala": {
        "configPath": ""
    }
}

Home Options: Options from /Users/mmeyer/.jsbeautifyrc

{}

EditorConfig Options: Options from EditorConfig file

{}

Project Options: Options from .jsbeautifyrc files starting from directory /Users/mmeyer/projects and going up to root

[
    {},
    {},
    {}
]

Results

Beautified File Contents:

function testit() {
  var one = 1;
  var two = 2
}

Logs:

2015-05-09T17:43:22.239Z - info: [/Users/mmeyer/.atom/packages/atom-beautify/src/beautifiers/index.coffee] beautify function testit() {
  var one = 1;
  var two = 2
}
 [ { indent_size: 2, indent_char: ' ', indent_with_tabs: false },
  { cs: { configPath: '' },
    c: { configPath: '' },
    cpp: { configPath: '' },
    css: 
     { indent_size: 2,
       indent_char: ' ',
       selector_separator_newline: false,
       newline_between_rules: false,
       preserve_newlines: false },
    d: { configPath: '' },
    html: 
     { 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: [Object],
       end_with_newline: false },
    java: { configPath: '' },
    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 },
    objectivec: { configPath: '' },
    pawn: { configPath: '' },
    perl: { perltidy_profile: '' },
    php: { fixers: '', level: '' },
    python: { max_line_length: 79, indent_size: 2, ignore: [Object] },
    sql: { indent_size: 2, keywords: 'upper', identifiers: 'lower' },
    vala: { configPath: '' } },
  {},
  {},
  {},
  {},
  {} ] JavaScript /Users/mmeyer/projects/testit.js
2015-05-09T17:43:22.241Z - verbose: [/Users/mmeyer/.atom/packages/atom-beautify/src/beautifiers/index.coffee] JavaScript name=JavaScript, namespace=js, grammars=[JavaScript], extensions=[js], type=integer, default=2, minimum=0, description=Indentation size/length (Supported by JS Beautify, Pretty Diff), title=JavaScript - Indent size, beautifiers=[JS Beautify, Pretty Diff], type=string, default= , minimum=0, description=Indentation character (Supported by JS Beautify, Pretty Diff), title=JavaScript - Indent char, beautifiers=[JS Beautify, Pretty Diff], type=integer, default=0, description=Initial indentation level (Supported by JS Beautify), title=JavaScript - Indent level, beautifiers=[JS Beautify], type=boolean, default=false, description=Indentation uses tabs, overrides `Indent Size` and `Indent Char` (Supported by JS Beautify), title=JavaScript - Indent with tabs, beautifiers=[JS Beautify], type=boolean, default=true, description=Preserve line-breaks (Supported by JS Beautify, Pretty Diff), title=JavaScript - Preserve newlines, beautifiers=[JS Beautify, Pretty Diff], type=integer, default=10, description=Number of line-breaks to be preserved in one chunk (Supported by JS Beautify), title=JavaScript - Max preserve newlines, beautifiers=[JS Beautify], type=boolean, default=false, description=Add padding spaces within paren, ie. f( a, b ) (Supported by JS Beautify), title=JavaScript - Space in paren, beautifiers=[JS Beautify], type=boolean, default=false, description=Enable jslint-stricter mode (Supported by JS Beautify), title=JavaScript - Jslint happy, beautifiers=[JS Beautify], type=boolean, default=false, description=Add a space before an anonymous function's parens, ie. function () (Supported by JS Beautify), title=JavaScript - Space after anon function, beautifiers=[JS Beautify], type=string, default=collapse, enum=[collapse, expand, end-expand, none], description=[collapse|expand|end-expand|none] (Supported by JS Beautify), title=JavaScript - Brace style, beautifiers=[JS Beautify], type=boolean, default=false, description=Break chained method calls across subsequent lines (Supported by JS Beautify), title=JavaScript - Break chained methods, beautifiers=[JS Beautify], type=boolean, default=false, description=Preserve array indentation (Supported by JS Beautify), title=JavaScript - Keep array indentation, beautifiers=[JS Beautify], type=boolean, default=false, description= (Supported by JS Beautify), title=JavaScript - Keep function indentation, beautifiers=[JS Beautify], type=boolean, default=true, description= (Supported by JS Beautify), title=JavaScript - Space before conditional, beautifiers=[JS Beautify], type=boolean, default=false, description= (Supported by JS Beautify), title=JavaScript - Eval code, beautifiers=[JS Beautify], type=boolean, default=false, description=Decode printable characters encoded in xNN notation (Supported by JS Beautify), title=JavaScript - Unescape strings, beautifiers=[JS Beautify], type=integer, default=0, description=Wrap lines at next opportunity after N characters (Supported by JS Beautify), title=JavaScript - Wrap line length, beautifiers=[JS Beautify], type=boolean, default=false, description=End output with newline (Supported by JS Beautify), title=JavaScript - End with newline, beautifiers=[JS Beautify], beautifiers=[JS Beautify, Pretty Diff, Pretty Diff, Pretty Diff, Pretty Diff]
2015-05-09T17:43:22.241Z - verbose: [/Users/mmeyer/.atom/packages/atom-beautify/src/beautifiers/index.coffee] beautifier JS Beautify silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, languages=[HTML, Handlebars, Mustache, Marko, JavaScript, JSON, CSS], silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, silly=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, debug=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, verbose=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, info=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, warn=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, error=function (msg) {
      // build argument list (level, msg, ... [string interpolate], [{metadata}], [callback])
      var args = [level].concat(Array.prototype.slice.call(arguments));
      target.log.apply(target, args);
    }, onLogging=function (handler) {
        var subscription;
        subscription = emitter.on('logging', handler);
        return subscription;
      }, languages=[CSV, ERB, EJS, HTML, XML, Spacebars, JSX, JavaScript, CSS, SCSS, Sass, JSON, TSS, LESS]
mpmeyer commented 9 years ago

contents of .atom/packages/atom-beautify/.jsbeautifyrc

{
  "indent_size": 2,
  "indent_char": " ",
  "indent_level": 0,
  "indent_with_tabs": false,
  "preserve_newlines": true,
  "max_preserve_newlines": 2,
  "jslint_happy": true,
  "end_with_newline": true
}
Glavin001 commented 9 years ago

I have changed how the options are being handled ( see #346 ). Please update to v0.27.2 and let me know if this works for you. Thank you.

mpmeyer commented 9 years ago

Thx, it still does not appear to read the settings from: .atom/packages/atom-beautify/.jsbeautifyrc

I have tried:

{
  "end_with_newline": true
}

and:

{
  "js": {
    "end_with_newline": true
  }
}
Glavin001 commented 9 years ago

I apologize, I may have not looked closely enough at your path to .jsbeautifyrc. Why are you editing the package's .jsbeautifyrc? You should have your own .jsbeautifyrc file in your project's directory, home directory (~), or any directory from the file you are beautifying and upwards to root /.

If I set it in my home directory, .jsbeautifyrc, then it seems to work.

From the sounds of it, this is working, so I am going to close this issue. I am sorry for any confusion.

Please confirm that it is also working for you in your project's directory. Thanks.

Please see the documentation for more details: https://github.com/Glavin001/atom-beautify#configuration

mpmeyer commented 9 years ago

Thanks, I somehow thought that the package's settings were used, I will add to home or project folder.