jdavisclark / JsFormat

Javascript formatting for Sublime Text 2 & 3
1.42k stars 222 forks source link

unable to override default settings in ST 3 #172

Closed szimmers closed 7 years ago

szimmers commented 8 years ago

i recently installed JSFormat and for the first time am trying to override some settings. i'm using Sublime Text build 3114.

here are the complete contents of my ST user prefs:

{
    "ignored_packages":
    [
    ],
    "jsbeautifyrc_files": true,
    "indent_size": 16,
    "brace_style": "expand",
    "vintage_start_in_command_mode": true
}

in my home directory (OS X 10.5.5), i have a .jsbeautifyrc file:

{
    "indent_size": 16,
    "indent_char": " ",
    "indent_with_tabs": true,
    "brace_style": "expand"
}

i have not only relaunched ST but also rebooted. when i format JS, the file definitely formats, but it's definitely not indenting 16 and definitely not expanding braces as i've specified.

CaitlinWeb commented 7 years ago

My best guess is because you have "indent_with_tabs": true which overrides indent_size. Try setting it to false?

jdavisclark commented 7 years ago

@szimmers It looks like you are mixing up sublime settings, and JsFormat settings. Our documentation on those rc files is not great, thats my bad.

your sublime default or user config only controls actual sublime settings, not settings for any plugins; the reverse is true as well; e.g.:jsbeautifyrc_files is not valid in your sublime config file. JsFormat supports .jsbeautifyrc files, but only for jsbeautifier settings; here is the exact list of options supported in .jsbeautifyrc files.

Ultimately, I think you main problem is that you specified jsbeautifyrc_files in your sublime config file, rather than the JsFormat config file. Open your JsFormat config up (on OSX) via Sublime Text -> Preferences -> Package Settings -> JsFormat -> Settings - User. You can look at Settings - Default as well, but add overrides to your user settings rather than changing the default ones.

szimmers commented 7 years ago

yes that fixed it, thanks!