NO NEED FOR THIS PLUGIN.
If you're using a format plugin based on js-beautify, such as Sublime JsFormat, you have a config perfectly for this:
"brace_style": "collapse-preserve-inline"
Sometimes I want a single line Object when writting JavaScript.
But JS Formatter always try to unfold Objects.
So I need SingleLiner.
Open sublime, go to Preferences -> Browse packages...
, and download singleliner
to this directory:
git clone git@github.com:JeremyFan/sublime-singleliner.git
Go to Preferences -> Key Bindings
, and config a shortcut you like, for example ctrl + shift + s
:
{
"keys": ["ctrl+shift+s"],
"command": "single_line"
}
const obj = {
foo,
bar: 123
}
then:
const obj = { foo, bar: 123 }
const {
code,
data
} = response
then:
const { code, data } = response
const obj = {
foo: 123,
bar
baz: { qux }
}
then:
const obj = { foo: 123, barbaz: { qux } }
Much beautiful and clear, isn't it?