Home Download Buy Blog Forum Support

Req.: Code Formater/beautifier

Req.: Code Formater/beautifier

Postby molchy on Mon Jan 09, 2012 3:22 pm

Code formating for:
- HTML
- CSS
- JS
- PHP
... other langs. later ;)

I think this future in Sublime Text 2 can bring alot of people because APP developers mostly use Microsoft Visual Strudio and other developers (web, scripting ...) editors like this.

I know code is indented when in new line but CUT-ing and COPY-ing does not indent code so their should be option Format whole code via keyboard and menu.

I know their is JS Formater and PHP formater:
- JS formater send data to web which i dont like because code is private property
- PHP formater doesnt work :( getting strange error

Hopefully this feauture will be realesed till BETA ends.
molchy
 
Posts: 6
Joined: Fri Jan 06, 2012 4:46 pm

Re: Req.: Code Formater/beautifier

Postby tito on Mon Jan 09, 2012 3:28 pm

HTML: https://github.com/SublimeText/Tag
JS: https://github.com/jdc0589/JsFormat ( no code to network, works locally )
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Req.: Code Formater/beautifier

Postby molchy on Tue Jan 10, 2012 8:33 pm

tito wrote:HTML: https://github.com/SublimeText/Tag
JS: https://github.com/jdc0589/JsFormat ( no code to network, works locally )


Tnx JSFormat works well
HTML tag plugins works also but has issues with PHP mixed in HTML.

What i dont like about this seperate plugins is that each one has its own keybinding and are seperated plugins.

Would it be great that their is one plugins which contains:
- One keybinding CTRL+F
- All in one plugin which detects what file it is and use that formating
- Formating HTML, CSS,JS, PHP ...
molchy
 
Posts: 6
Joined: Fri Jan 06, 2012 4:46 pm

Re: Req.: Code Formater/beautifier

Postby C0D312 on Tue Jan 10, 2012 8:39 pm

molchy wrote:Would it be great that their is one plugins which contains:
- One keybinding CTRL+F
- All in one plugin which detects what file it is and use that formating
- Formating HTML, CSS,JS, PHP ...


You can change the keybindings to all be the same (they don't need to be the same plugin) and there won't be any conflicts as long as the plugins know to only run in a certain scope.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Req.: Code Formater/beautifier

Postby bizoo on Wed Jan 11, 2012 6:26 am

One plugin to rule them all...
Code: Select all
import sublime, sublime_plugin

class FormatFileCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      if self.view.match_selector(0, "source.js, source.json"):
         self.view.run_command("js_format")
      elif self.view.match_selector(0, "text.html.basic"):
         self.view.run_command("html_tidy")
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: Req.: Code Formater/beautifier

Postby tito on Wed Jan 11, 2012 11:49 am

molchy:
Tag package key binding has been changed to "CTRL+ALT+F" as in jsformat.
CTRL+F is find!
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Req.: Code Formater/beautifier

Postby molchy on Wed Jan 11, 2012 6:32 pm

tito wrote:molchy:
Tag package key binding has been changed to "CTRL+ALT+F" as in jsformat.
CTRL+F is find!


Yea sorry typo ;) tnx

Tested sublime text 2 and is nice but some feautures are missing which are needet for my development so will stick with Netbeans 7.1 until this feautures are in sublime text:
- HTML ( Doesnt brake if PHP in it ), CSS, XML,JS, PHP formater as one plugin
- Good is that code frameworks can be implemented in snippets for auto complete so thats not issue
- Function DOC tip
- Visaul Diff tool which shows two documents and differences
- Navigator which shows (HTML DOM structure, CSS structure, PHP functions) and on click jumps to the function
- When working on file i wanna see open path to it in file browser
... maybe some other stuff but cant remamber ;)

Sublime text 2 is not bad but i dont wanna pay for licence if i must develop plugins for it to have what i need in my development. I need a tool which i setup, install plugins and use.
molchy
 
Posts: 6
Joined: Fri Jan 06, 2012 4:46 pm

Re: Req.: Code Formater/beautifier

Postby svenax on Wed Jan 11, 2012 8:02 pm

molchy wrote:Tested sublime text 2 and is nice but some feautures are missing which are needet for my development so will stick with Netbeans 7.1 until this feautures are in sublime text:
- HTML ( Doesnt brake if PHP in it ), CSS, XML,JS, PHP formater as one plugin
- Good is that code frameworks can be implemented in snippets for auto complete so thats not issue
- Function DOC tip
- Visaul Diff tool which shows two documents and differences
- Navigator which shows (HTML DOM structure, CSS structure, PHP functions) and on click jumps to the function
- When working on file i wanna see open path to it in file browser
... maybe some other stuff but cant remamber ;)

Sublime text 2 is not bad but i dont wanna pay for licence if i must develop plugins for it to have what i need in my development. I need a tool which i setup, install plugins and use.


So, in short you want SublimeText behave like Netbeans. If you are happy with Netbeans, why not just stick with it?
svenax
 
Posts: 154
Joined: Tue Dec 20, 2011 12:47 pm

Re: Req.: Code Formater/beautifier

Postby molchy on Thu Jan 12, 2012 11:29 am

svenax wrote:
molchy wrote:Tested sublime text 2 and is nice but some feautures are missing which are needet for my development so will stick with Netbeans 7.1 until this feautures are in sublime text:
- HTML ( Doesnt brake if PHP in it ), CSS, XML,JS, PHP formater as one plugin
- Good is that code frameworks can be implemented in snippets for auto complete so thats not issue
- Function DOC tip
- Visaul Diff tool which shows two documents and differences
- Navigator which shows (HTML DOM structure, CSS structure, PHP functions) and on click jumps to the function
- When working on file i wanna see open path to it in file browser
... maybe some other stuff but cant remamber ;)

Sublime text 2 is not bad but i dont wanna pay for licence if i must develop plugins for it to have what i need in my development. I need a tool which i setup, install plugins and use.


So, in short you want SublimeText behave like Netbeans. If you are happy with Netbeans, why not just stick with it?


Sublime has some feautures which are better or new and useful also. Not all of above feautures are 100 % needet but multie purpuse Code Formater is something which every editor need. Auto compleate can be self made so their is no problem. Other stuff is good but not 100 % nesecary.

So make code formater which works HTML, PHP, CSS, XML, JS and i am happy with sublime ;) auto compleate for Codeigniter i can make myself ;)
molchy
 
Posts: 6
Joined: Fri Jan 06, 2012 4:46 pm


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 5 guests