Author Topic: Auto complete brackets?  (Read 9106 times)


  • Guest
Auto complete brackets?
« 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...
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?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: Auto complete brackets?
« Reply #1 on: December 26, 2008, 05:08:36 pm »
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 :(

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 202
Re: Auto complete brackets?
« Reply #2 on: January 01, 2009, 01:41:34 pm »

You could find a sample of how to create a smart indent plugin here:,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