Home Download Buy Blog Forum Support

Javascript Formatter

Re: Javascript Formatter

Postby vortec on Fri Nov 18, 2011 1:20 pm

Running Linux, the plugin doesn't appear in the palette.
vortec
 
Posts: 3
Joined: Fri Nov 18, 2011 1:16 pm

Re: Javascript Formatter

Postby jdc0589 on Tue Nov 22, 2011 5:48 pm

emelie wrote:Installed this via Package Control - works great!

And just for the people who stumble upon this and don't know what Package Control is - check it out here:
http://wbond.net/sublime_packages/package_control


Glad to hear it!

On a side note, I just submitted a pull request to get JsFormat added to the default package control repository list, so hopefully it will be available right out of the box soon.
jdc0589
 
Posts: 32
Joined: Fri Jun 03, 2011 2:32 am

Re: Javascript Formatter

Postby jdc0589 on Tue Nov 22, 2011 5:51 pm

vortec wrote:Running Linux, the plugin doesn't appear in the palette.



Hmm...I use it on linux every day. Just to be safe, get the plugin off of github/package control rather than the download in the first post (it should be fine though). Do you get any errors in the console? Feel free to submit an issue here: https://github.com/jdc0589/JsFormat/issues (I forget to check this thread regularly).
jdc0589
 
Posts: 32
Joined: Fri Jun 03, 2011 2:32 am

Re: Javascript Formatter

Postby jdc0589 on Sat Dec 03, 2011 10:59 pm

Just pushed an update. JsFormat now pulls indentation character (space vs tab) settings from the main sublime config. If its set to translate tabs to spaces, JsFormat will use the number of spaces specified via the tab_size setting. Otherwise a single tab character is used.
jdc0589
 
Posts: 32
Joined: Fri Jun 03, 2011 2:32 am

Re: Javascript Formatter

Postby jdc0589 on Fri Jan 13, 2012 3:47 am

new version published.
All js_beautifier settings are now exposed and can be overridden via user file settings.
jdc0589
 
Posts: 32
Joined: Fri Jun 03, 2011 2:32 am

Re: Javascript Formatter

Postby gptwisted on Sat Jan 14, 2012 1:55 pm

I absolutely love this plugin, thank you a lot for developing it and for making my code look better!

  • When i format my code, the caret is positioned at the end of the file. This is very annoying, although I understand it's hard to get the original caret position after the format. Eclipse actually can do it, so maybe it's possible – or we have to wait an update to the SublimeText APIs. Are you also annoyed by this?
  • [MINOR] The previous issue being solved, I would like to get my code automatically formatted when I close a block with }
gptwisted
 
Posts: 3
Joined: Thu Dec 22, 2011 12:30 pm

Re: Javascript Formatter

Postby jdc0589 on Sun Jan 29, 2012 6:46 am

gptwisted wrote:I absolutely love this plugin, thank you a lot for developing it and for making my code look better!

Thanks! always nice to hear.

I would definitely encourage you to file bug reports over at https://github.com/jdc0589/JsFormat/issues for any bugs or feature requests ( I will see it immediately there).
gptwisted wrote:
  • When i format my code, the caret is positioned at the end of the file. This is very annoying, although I understand it's hard to get the original caret position after the format. Eclipse actually can do it, so maybe it's possible – or we have to wait an update to the SublimeText APIs. Are you also annoyed by this?

To be honest, it doesn't really bother me. However, it will probably drive me nuts now that you have brought it to my attention :). There are a few ways I could do this. Ill think about the best way to do it and push an update in the next few days.

gptwisted wrote:
  • [MINOR] The previous issue being solved, I would like to get my code automatically formatted when I close a block with }

Interesting. How often are you having to manually close code blocks? sublime always auto pairs ([{ characters for me and I almost never find myself typing the closing character.
jdc0589
 
Posts: 32
Joined: Fri Jun 03, 2011 2:32 am

Re: Javascript Formatter

Postby gptwisted on Sat Feb 11, 2012 4:33 pm

jdc0589 wrote:[about caret positioning] To be honest, it doesn't really bother me. However, it will probably drive me nuts now that you have brought it to my attention :). There are a few ways I could do this. Ill think about the best way to do it and push an update in the next few days.

Well in my workflow I usually write some code, then I format it: when I do, I lose the focus in my file. Since the buffer is often different, the line where the caret was is now in another position of the screen, and i'm not fast enough to identify it easily.
I see you added the issue on github, thank you - i will do that the next time.
jdc0589 wrote:
gptwisted wrote:
  • [MINOR] The previous issue being solved, I would like to get my code automatically formatted when I close a block with }
Interesting. How often are you having to manually close code blocks? sublime always auto pairs ([{ characters for me and I almost never find myself typing the closing character.

Yes you are right, forget it :)

gp
gptwisted
 
Posts: 3
Joined: Thu Dec 22, 2011 12:30 pm

Re: Javascript Formatter

Postby jdc0589 on Mon Feb 13, 2012 2:16 am

Just pushed an update. The cursor is now re-positioned to the same place it was prior to formatting (accounts for whitespace/formatting changes).
jdc0589
 
Posts: 32
Joined: Fri Jun 03, 2011 2:32 am

Re: Javascript Formatter

Postby rdougan on Tue Feb 28, 2012 11:22 pm

Thanks for this. I've been wanting this for a while, but never bothered looking.

Quick question: are you able to keep the selection indentation level? For example, if I run it on this code:

Image

..it will not keep its indentation:

Image

Thoughts?

Either way, massive thanks!
rdougan
 
Posts: 44
Joined: Sat Apr 09, 2011 2:37 am

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: icylace, Majestic-12 [Bot] and 14 guests