Started to work on source-formatter

David Nolden zwabel at
Sat Dec 5 11:05:50 UTC 2009

Am Samstag 05 Dezember 2009 10:56:44 schrieb Esben Mose Hansen:
> On Friday 04 December 2009 15:50:09 Andreas Pakulat wrote:
> > On 04.12.09 14:56:39, Esben Mose Hansen wrote:
> > > On Thursday 03 December 2009 20:56:45 Andreas Pakulat wrote:
> > > > just so there's no duplicated efforts: I've just started a local
> > > > branch to work on the sourceformatter codebase in the next days to
> > > > fix the issues the API and implementation has. I hope this is done by
> > > > the end of sunday so it'll be part of the next beta.
> > >
> > > excellent! Any chance this API can support indent-as-you-type?
> >
> > No, the only thing we could add at a later point is automatic
> > reformatting on save. Any on-the-fly-formatting needs to go into
> > kate(part).
> Weird, I thought I had answered this.
> In any case, I think that we can do much better than Kate by using the du-
> chain. If it makes sense, I think we should integrate this into the API, so
> that we can get indent-as-you-type, I even think David's indent-at-enter
>  lacks ambition.. why not at each keystroke? Imagine being able to just
>  type away, and having long lines split and rejoin sensible while type and
>  delete. Not saying we will get this in March, but if the idea was at least
>  possible with the API suggested, I'd be cool.

The problem is
a) While writing code, it is no 'valid' code, so you don't know what it's 
becoming, and thus you cannot indent it properly.
b) "Indent on enter" would (hopefully) be compatible with publically 
accessible indenters like "astyle", "uncrustify",  etc. without modifications, 
while for indent-per-keystroke you'd probably need a completely own indenter 
solution that also works on partially written code by anticipating what you 
might be writing. Past has shown that we don't have the resources the maintain 
such a beast. ;-)

Well, we could try to emulate some "indent on stroke"-like behavior with some 
hacks, but only if we find a solution on how to use external indenters for 
that. The public interface for indenters is usually "give file text" -> 
"return reformatted file text" and not much more.

Greetings, David

More information about the KDevelop-devel mailing list