[quote=“de.monkeyz”]@vvo - I got it working with tabs, all I did was change the options to these:
opts.indent_char = "\t"
opts.indent_size = 1
And it works perfectly.
I also added this code to make sure it only works in js files:
if not self.view.scope_name(0).startswith('source.js'):
return
If you’re using a build below 2099. Change startswith to endswith.[/quote]
Thanks for responding to the indent question, I kind of forgot to keep checking back in here.
I may pull something like your scope_name solution in to the plugin, Ill have to play around with it.
[quote=“bgreenlee”]This is great, thanks. Formatting Javascript/JSON is one thing I kept bouncing back to TextMate for.
One suggestion: add a JsFormat.sublime-commands file so that it appears in the Command Palette:
{ "caption": "Format: Javascript", "command": "js_format" }
]
[/quote]
Good suggestion, ill add it in the next day or so.
UPDATE: plugin updated, shows up in command palette now