EmEditor (text editor) Forum Index
   Enhancement Suggestions about Plug-ins
     Code auto format (pretty-print) plugin
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
maxim2004
Posted on: 11/25/2008 11:29 am
Just popping in
Joined: 11/25/2008
From:
Posts: 9
Code auto format (pretty-print) plugin
Your perfect editor misses a very important kind of plugin - a configurable pretty-print code formatter that would use some sort of configuration files similar to syntax files for programming languages you have now in EmEditor.

A perfect illustration of idea is Eclipse 3 IDE for Java which permits to autoformat any section of java file with key combination Ctrl+Shift+I on selected section of text.
dreftymac
Posted on: 11/26/2008 6:11 pm
Not too shy to talk
Joined: 10/1/2008
From:
Posts: 39
Re: Code auto format (pretty-print) plugin
Greetings Maxim,

This can be done very easily with a macro if you have a parser or processor that can be run from the Windows command line against a file via your own custom function.

For example, you can pass the currently selected text to a function that cleans up the code for whatever default syntax you are using.


mysyntax   = document.ConfigName;
mycode     =   document.selection.Text;
myresult    =   MyCleanupSyntax(mysyntax,mycode);
document.selection.Text = myresult;

The hard part will be finding a code-formatter that you can plug into your MyCleanupSyntax function. I am sure there are plenty available for Java-style syntax.

maxim2004
Posted on: 12/5/2008 8:12 am
Just popping in
Joined: 11/25/2008
From:
Posts: 9
Re: Code auto format (pretty-print) plugin
Thanks, pal. Somehow I missed the possibility of writing macros. I'll experiment.
Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文