New editor option: Bracket Completion

So honestly, this has been bugging me for so long I have no idea why it took me this long to implement. Background first:

I write eclipse plugins for a living. I've been doing it for almost eight years now, even though it seems like a lot longer. In Eclipse, when you're typing along, and you type a bracket of some sort (like "(" or "[" for example) a matching pair is inserted into the code as well. When you are doing function braces, (ie "{") and you hit enter after the brace it also inserts the companion closing brace as well as indents the cursor. It drives me NUTS when I use another editor now that does not have similar functionality for the language. Like, I don't know, say WOTgreal for instance...

Sigh... My own tool was against me...

So today I finally implemented it. I do not have the full code formatting stuff that Eclipse has (I hope to get to that as well with the 50 BAZILLION options that should be available) so that your code can look all nice. But as of now, there is a new option called "Bracket Completion" for your editor enjoyment in the current dev build. This is on by default, but you can turn it off in the editor options portion of preferences.

Comments
Awesome!

I personally will probably not use that feature since I got used to typing everything when and where I need it but it's great how you keep all features of WOTgreal optional and fully customizable to our own best way to work with it. :)
# Posted By Crusha | 9/24/11 3:59 PM
This is the BEST! I too have been using Code::Blocks, Visual Studio and Eclipse, and the auto-complete brackets are one of my favorite options (just because I always forget the fifth closing brace).
Thankyou for continuing to make WOTgreal awesome! It makes picking up and working with the UDK very easy.
# Posted By Griffork | 9/29/11 8:18 PM
Ok, I actually got to test it now.
I have to admit that the way this is implemented (if you type the second bracket yourself with this enabled, it will ignore that so you don't get it doubled) makes it indeed a lot easier while not even interfering in my old work flow. Kudos!

Just noticed one time that it automatically inserted a closing } when I hit return in the DefaultProperties block to add a new line for more properties at the beginning. Maybe the functionality should count the number of opening and closing brackets before deciding if one should be created or not?
# Posted By Crusha | 9/30/11 4:56 AM
I debated what to do here, honestly. That behavior only happens with the { symbol and the pair is inserted when you hit enter, which is the same behavior that Eclipse has. I'll see if I can make it any better
# Posted By Dean Harmon | 9/30/11 6:50 AM
Crusha, give it a try again. I improved the algorithm so it will not add the extra characters in unless you typed that beginning brace immediately before hand.
# Posted By Dean Harmon | 9/30/11 9:17 AM
Yay, that works perfect. :)

Retrospective did I like the feature already in NetBeans and just never missed it here. But it's a nice-to-have one now. :)



While we are currently at the topic of making things more user friendly by automatizing certain processes:
It would be great if we could define certain templates and then insert them easily via hotkeys or a button in the interface into our code.

For instance does Epic have a unified way for their function descriptions that goes like

/**
* Breaks up a delimited string into elements of a string array.
*
* @param BaseString - The string to break up
* @param Pieces - The array to fill with the string pieces
* @param Delim - The string to delimit on
* @param bCullEmpty - If true, empty strings are not added to the array
*/
native static final function ParseStringIntoArray(string BaseString, out array<string> Pieces, string Delim, bool bCullEmpty);


And me and Wormbo usually wrap our descriptions into a nice block like this

// ============================================================================
// GainedChild
//
// This is the only place where we can assign our custom KParam as KParam of
// the spawned KActor before the Karma physics are initilizing.
// ============================================================================

simulated function GainedChild(Actor Other)
{
if (DynamicSpawnableKarmaThing(Other) != None)
{
DynamicSpawnableKarmaThing(Other).KParams = LevelOfDestruction[i_temp].KarmaDeco[j_temp].KActorParameters;
}
}


So it would make things much easier and the code easier to document if we could define our own unified layout and insert it quickly. :)

Just giving suggestions, it's your time after all and there are probably more urgent topics out there.
# Posted By Crusha | 9/30/11 6:25 PM
You can do this already. Go to Tools->Code Templates. Here you can configure whatever code insertion things you want, and then when you hit the keystroke (default is Ctrl+J, but you can change it on that same dialog) it will insert the template for you. Just like Ctrl+Space, but you define what goes into the list.
# Posted By Dean Harmon | 9/30/11 6:43 PM
Ah, great then. :D
# Posted By Crusha | 9/30/11 7:36 PM
This doesn't work very well unless you have Tab inserts Hard Tabs on in the editor preferrences, then it seems to work pretty well. When it's not set, the spacing gets all sorts of out of whack
# Posted By Eric Blade | 10/15/11 3:33 AM
I suppose that the "greal" part of the name derives from terangreal (magic artifacts and spells in the series).
# Posted By professional term paper help | 12/28/11 7:34 AM
# Posted By Louis vuitton outlet store | 4/25/12 3:14 AM
# Posted By nike outlet store | 5/4/12 4:52 AM
http://www.christianlouboutinstorm.com Christian Louboutin Shoes
http://www.christianlouboutinstorm.com/christian-louboutin-pumps-c-2.html" target="_blank">http://www.christianlouboutinstorm.com/christian-l... Christian Louboutin Pumps
http://www.christianlouboutinstorm.com/christian-louboutin-peep-toe-c-7.html" target="_blank">http://www.christianlouboutinstorm.com/christian-l... Christian Louboutin Peep Toe
http://www.christianlouboutinstorm.com/christian-louboutin-evenings-c-3.html Christian Louboutin Evenings
http://www.christianlouboutinstorm.com/christian-louboutin-sandals-c-1.html" target="_blank">http://www.christianlouboutinstorm.com/christian-l... Christian Louboutin Sandals
http://www.christianlouboutinstorm.com/christian-louboutin-slingback-c-5.html" target="_blank">http://www.christianlouboutinstorm.com/christian-l... Christian Louboutin Slingback
http://www.christianlouboutinstorm.com/christian-louboutin-wedges-c-4.html" target="_blank">http://www.christianlouboutinstorm.com/christian-l... Christian Louboutin Wedges
http://www.supratksocietyonsale.com/justin-bieber-... Justin Bieber Supra Shoes
http://www.supratksocietyonsale.com/supra-owen-c-3... Supra Owen
http://www.supratksocietyonsale.com/supra-skytop-c... Supra Skytop Shoes
http://www.supratksocietyonsale.com/supra-skytop-m... Mens Supra Skytop
http://www.supratksocietyonsale.com/supra-skytop-w... Supra Skytop Womens
http://www.supratksocietyonsale.com/supra-skytop-i... Supra Skytop III
http://www.supratksocietyonsale.com/supra-tk-socie... Supra Tk Society
http://www.supratksocietyonsale.com/supra-tk-socie... Mens Supra Tk Society
http://www.supratksocietyonsale.com/supra-tk-socie... Womens Supra Tk Society

werwe
# Posted By xiaozhang | 5/11/12 5:22 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.