Author Topic: paren brace and double quote completion like netbeans  (Read 6212 times)

Silas Tomkyn Combermache

  • Junior Community Member
  • Posts: 9
  • Hero Points: 0
paren brace and double quote completion like netbeans
« on: November 05, 2009, 01:19:46 am »
Is there a way to turn on the parenthesis completion, braces etc like the netbeans ide does? I can't find a way to turn it on if it is there. Ultra edit has had this for a long time.
thanks,
pb

Graeme

  • Senior Community Member
  • Posts: 2357
  • Hero Points: 309
Re: paren brace and double quote completion like netbeans
« Reply #1 on: November 06, 2009, 11:04:10 am »
There's no configurable option for this for parenthesis but you can write/modify some slick C to get it - http://community.slickedit.com/index.php?topic=3396.0
It doesn't handle the case of when the closing parenthesis is already present, which I guess is one reason for not having it.  How does ultra-edit handle that?

For the { -  by default, if you type an opening brace (in C/C++/java etc) slick inserts the closing brace automatically.  You can turn this on/off by changing def_expand_brace_syntax  - use the set macro variable command on the macro menu.

You can write a macro to handle the quote " - similar to the one for parenthesis but it will also have problems with the fact that you sometimes  want only one quote and sometimes two.

Graeme

mwb1100

  • Senior Community Member
  • Posts: 143
  • Hero Points: 13
Re: paren brace and double quote completion like netbeans
« Reply #2 on: November 08, 2009, 02:32:54 am »

It doesn't handle the case of when the closing parenthesis is already present, which I guess is one reason for not having it.  How does ultra-edit handle that?


In my experience not very well. If I remember right, only UltraEdit Studio offers automatically adding a closing ), ], or } character (but not an automatic closing quote).  I don't think this is available in the standard UltraEdit editor (but I might be wrong).  I don't use UEStudio much anymore, but I found the automatic closing of ')' and ']' to happen at the wrong time enough that I turned it off (I left the auto closing of '}' - it didn't seem to need fixing up as much).

(same for the automatic closing braces, which is only available in UltraEdit Studio I think). I often find myself fixing up extra parens etc. when editing.  It's almost annoying enough that I consider turning it off every now and again.  But I don't use UEStudio much anymore, so it pretty much just stays configured as is.

However, the Visual Assist X addin for Visual Studio does a fantastic job of adding the closing quote/brace/paren only when necessary. When I'm in Visual Studio I almost never need to undo a closing paren/brace/quote that it's added. It seems quite smart about when to not bother.  There are times when it gets it wrong, but that's unavoidable I think; it does seem to get it right far more often than not.  Of course, there's no script or macro code to look at for it, so that's no real help to getting it working well in SlickEdit except for being able to try it out to see how it works.

One possible advantage that Visual Assist has in this is that it has a limited set of languages that it needs to provide the support for, though I'd expect that the same algorithms would work similarly in pretty much any language (maybe excepting lisp...)
« Last Edit: November 08, 2009, 02:35:24 am by mwb1100 »

jimlangrunner

  • Senior Community Member
  • Posts: 360
  • Hero Points: 31
  • Jim Lang - always a student.
Re: paren brace and double quote completion like netbeans
« Reply #3 on: November 08, 2009, 02:25:03 pm »
My take on it.

Visual Studio / SQL Server MGMT studio handles this nicely, at least as far as I've encountered it.

If you insert a closing brace (paren, quote, etc.), then I think the appropriate thing to do is to ignore / jump over the closing brace when it is typed by the user.  When I type an open paren, go ahead and insert the close paren.  But when I type in a close paren (which I do often), jump over that close paren.  Don't make me go back and delete it, and don't make me take my hands off the home row to reach for anything (even the arrow keys).  That's just wasteful.

SE knows enough about open & close items now to be able to highlight them when you close them, why not jump over them? 

SE is the best text editor around, and when it comes to searches, file mods, and cool editing, it's the place to go.  But I don't create much code in Slick simply because I get so frustrated typing, then removing, closing characters.  I've been doing this too long to change now.  Just like the two spaces I put between sentences - something drilled into me 25+ years ago on a manual typewriter.  I'm not changing now, even when I try to.  I have no hope of not typing a closing character.  It's just ingrained by now.  In that case, Visual Studio has slick beat hands down.

Jim.