Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: Hnefi on June 02, 2009, 04:59:19 pm
-
Heyall. Been using C::B at home for some time, now I'm trying to adapt it to our toolchain here at work, so I'm going through issues I have while I evaluate it before recommending it to my coworkers.
One issue I have is with smart indenting - it doesn't really seem to do anything. Consider the following steps:
1: Enter the incomplete function call "Foo(bar," into the editor.
2: Hit "enter".
3: Enter the second parameter and finish the function call: "rab);".
Expected output (indentation is 2 whitespaces):
Actual output:
Is there an easy fix for this? I'm running SVN revision 5617, on the wxfnb_to_wxaui branch.
-
Is there an easy fix for this?
There is nothing to fix as the indention is based on the indention guidelines which you setup to 2 spaces (or alike), obviously.
Hence you might want to try the AStyle plugin.
-
Ah, but I'm using the AStyle plugin, with the guidelines I prefer. When I click the "Source Code Formatter (AStyle)" menu item, the whole file is formatted exactly the way I want it to be.
Unfortunately, that method doesn't work well because it adjusts the entire file - which is something I definitely do not want when I'm making changes in a branch of a huge source tree which I'm later expecting to merge with trunk.
Is there a way to make Smart Indentation mimic the behaviour of AStyle, or a way to apply AStyle to less than the entire file?
Thanks for your time.
-
Hm, I've been looking into the possibility of patching this myself. Finding the appropriate function and manipulating it is no problem; the code for C::B is very well designed. However, it turns out that the functionality I want is significantly more complex than I realized. Emacs, for example, has a 1200-line elisp source file to deal with this particular issue. Not something I'll be able to replicate in an afternoon and it seems the current cbEditor contains no logic to make things easier.
So far, I think I'll stay content with my halfway solution patch to the problem; I have implemented the indentation rules I want, which is really nice, but it doesn't ignore strings and comments properly. However, if anyone happens to know of advanced indentation functionality implemented in other open source IDE's, please give me a holler. I'd be tempted to copy such a solution.