Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: panicatthe on December 26, 2008, 04:44:35 pm
-
I'm not sure if this function is available in CB, by "auto complete brackets" i mean like...
ie.
if I type "{", then press enter, I get
{
<-carat goes here
}
the ide Eclipse has this built in. I was wondering, since CB is open source, has this been done before?
-
Nope, it's not implemented in CB. The closest thing to it is Abbreviations. Actually, it would be a good starting point to write a plugin that does that. From the Code Completion plugin it could be extracted the way to hook to the key press event in the editor. Using the highlighting attributes could also be a way to count the current number of opening/closing braces, to know if it's really necessary to add the closing brace or not. The Exporter plugin shows how to get access to it. Another piece of code worth checking for that would be the one that goes to the matching brace. Everything is there, it's just a matter of putting it all together into a plugin :D
Another decision could be to take abbreviations and smart indenting out of the core and put them into a new plugin that would also implement the automatic behavior you want.
As usual, the only thing that is missing is a person who decides to work on it :(
-
Hi
You could find a sample of how to create a smart indent plugin here:
http://forums.codeblocks.org/index.php/topic,8803.0.html (http://forums.codeblocks.org/index.php/topic,8803.0.html)
You just have to take indent mechanism for c/c++ out of cb and put it into a
new pugin and add the automatic behavior you want.
regards danselmi