Le 10/04/2012 01:59, Lex Trotman a écrit :
On 10 April 2012 09:05, Colomban Wendling lists.ban@herbesfolles.org wrote:
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
I can understand why it would do that to look ahead, but it would be good if it documented that it *does not* work with pipes.
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
Looking at the code it should give an error message if it can't seek in the file, so it should just generate no output, but maybe thats recent.
Or maybe I simply misremember what was the problem and it only truncated the output, I'm not 100% sure, though I think it was worst than that.
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.
Does that mean it is universal and can use any beautifier?
Well, "universal" is maybe a bit too presumptuous, but yeah, I wanted it to support any intenter. However, I made it "backend-based" style, so it can use e.g. a library, but it then requires the backend to be written, not simply a indenter program to exist.
And maybe integrate Universal Indent GUI to set them up?
Isn't that a Qt program? But yes, I wanted to do something like this -- actually each backend would export a set of options and a generic GUI would display them and allow to edit them.
Cheers, Colomban