mihai-vlc / sublime-jsfmt

jsfmt plugin for Sublime Text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable multiple var declarations

filipmares opened this issue · comments

I can't figure out for the life of me how to turn off the multiple var declaration setting.

Prevent:

var a = "1",
      b = "2";

From turning into:

var a = "1";
var b = "2";

That is not included by default.
Check your settings file I think you added this plugin https://github.com/twolfson/esformatter-var-each

{
    "options": {
        "plugins": []
    }
}

Odd. It looks like the jsfmt dependency includes that plugin https://github.com/rdio/jsfmt/blob/master/package.json

can you share your configuration file ? I can try to reproduce it locally but it seems to work fine for me.

I just removed and reinstalled it with same result. Here is my config file. I appreciated the help.

{
  // autoformat on save
  "autoformat": true,

  // array of extensions for autoformat
  "extensions": ["jsx", "js", "sublime-settings"],

  // options for jsfmt
  "options": {
    "preset": "jquery",
    "indent": {
      "value": "    "
    },
    // plugins included
    "plugins": [
      "esformatter-jsx-ignore"
      // "esformatter-quotes",
      // "esformatter-semicolons",
      // "esformatter-braces",
      // "esformatter-dot-notation"
    ]
  },
  "options-JSON": {
    "plugins": [
      "esformatter-quotes"
    ],
    "quotes": {
      "type": "double"
    }
  },
  "node-path": "node",
  "alert-errors": true,
  "ignore-selection": false
}

I just updated all the packages to the latest version and pushed a new release.
It should get to you in a couple of hours.

This problem was caused by the fact that I was merging the settings recursively and it was merging the array of plugins instead of replacing it.
Since the var-each plugin is included by default in jsfmt 0.5.0 you were getting that formatting.

Please let me know if it's fixed.

Thank you @ionutvmi! All good here.