Hi,
Le 09/04/2012 12:41, Lex Trotman a écrit :
On 9 April 2012 20:08, Nayan Shah nayan@nayanshah.com wrote:
Hello,
I am planning to develop a code re-formatting plugin for geany. I want it to be more on the lines of Notepad++'s C++ re-indent plugin which is pretty awesome.
I don't know Notepad++, but I started a indenter plugin awhile ago, I'll try to check where it is and make the source available if it can be useful. I should also finish it, but...
The feature could be something like : user selects bunch of text and clicks beautify or maybe it works on the whole file by default.
Astyle http://astyle.sourceforge.net/ is a small automatic formatter and released under LGPL. It is pretty small with loads of options. and supports C, C++, Java code.
Can it be used for development of the plugin ?
Any feedback / comments would be appreciated.
Yes you could make a plugin to run astyle, but it would probably be easier to just use it as a custom command, see http://www.geany.org/manual/current/index.html#sending-text-through-custom-c...
Unfortunately astyle does crazy stuff (like seeking back and forth) with its input, making impossible to pipe data to it (actually it'll work until the data size exceeds the OS's IO buffer size IIRC, but if it exceeds that size astyle will just hang indefinitely). Calling that executable requires a real file then. The plugin I talked about previously has an astyle backend too, but it writes a temp file for the very reason above.
So yes, AStyle can be used, but no, you can't pipe it data so it can't be used with custom commands. However, GNUIndent can.
Cheers, Colomban