Source Code Formatting in kdev4

Andreas Pakulat apaku at gmx.de
Fri May 4 13:41:10 UTC 2007


On 04.05.07 07:38:02, Matt Rogers wrote:
> On Friday 04 May 2007 06:04, Megan Webb wrote:
> > For source code formatting in  Kdev 4, I've started a wiki page at:
> > http://kdevelop.org/mediawiki/index.php/Source_Code_Formatter
> > with some ideas I've had. Feel free to update, or comment here on
> > what is listed.
> >
> > Really open to any ideas and suggestions you have at the moment for
> > formatting.
> >
> > I can say that I'm keen to have uncrustify as well as astyle support. My
> > thought is
> > that if we (I) drop using the library interface of the formatter, and
> > use either that
> > the formatter supports command line switches, or a configuration file of
> > options,
> > then we can then more easily support having other code formatters.
> >
> > The alternative is to continue to support astyle as is, and add options
> > for uncrustify
> > and others.
> >
> 
> Perhaps the best way to go is to create an interface for the source code 
> formatters that can be used so that we don't have to worry about how to call 
> the code from the rest of kdevelop. 

Plus two from me. I think the code-formatting plugin needs to work
similar to our documents and language parser, i.e. a plugin for the
interface would be loaded on a per mime-type basis. So I can have a
code-formatter for C++, one for Python and a 3rd one for HTML in the
same project. If we have a common interface for this we can even let
scripts run that format each document in a project automatically.

> > My reasoning for this is to (hopefully) be able to offer some support
> > for code formatters for
> > languages other than C/C++ and Java.
> 
> Yes indeed, code formatters for other languages would be nice to have.

And with an interface we don't need to do this ourselves, we can rely on
the community to add support for new formatters.

Andreas

-- 
You are a fluke of the universe; you have no right to be here.




More information about the KDevelop-devel mailing list