Intentation

Andreas Pakulat apaku at gmx.de
Wed Dec 26 11:02:24 UTC 2007


On 25.12.07 21:12:01, Vladimir Prus wrote:
> 
> Hi,
> one of my biggest problem with KDevelop as use is the way
> source code indentation works:
> 
> 1. There's auto-indentation provided by Kate, and (at least in
> 3.5) there's reformat feature, which uses completely different
> code path -- and will given different results compared to
> auto-indent.

Right, astyle does a much better job and has more options than the
kate-indenter.

> 2. It appears that some styles are just not possible (like
> the gnu style).
> 
> I have those questions:
> 
> 1. Anybody know off-hand if we can easily take over auto-indentation.

I'm not sure, but I suspect the answer is no. In particular I doubt we
can easily use astyle for auto-indenting as it needs context to know the
proper indentation. So you'd re-indent the whole file on each newline
which will bring performance issues. And I'm pretty sure we don't have
the power to invent our own indenter.

> 2. Any comments about using flexible indentation scheme, where
> various "syntactic elements" are given specific indent, that can
> be changed by user. That's how Eclipse and Emacs work, for example.

AFAIK thats what you do with astyle as well, however as any other
software astyle has bugs.

> 3. It it possible to extract syntax context from C++ parser (like,
> "we're inside class", or "we're in namespace scope"?

Yes.

Andreas

-- 
Stay away from hurricanes for a while.




More information about the KDevelop-devel mailing list