Author Topic: How do I turn off all auto insertion  (Read 9701 times)

jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
How do I turn off all auto insertion
« on: January 25, 2007, 05:10:58 pm »
I'm a new SE user, and I'm trying to turn off all automatic insertion of text (other than automatic indentation).  I've managed to get most everything turned off for the languages I use, except for JSPs, I can't get it to not insert a space, newline, and close scriptlet tag ("%>") after typing an open scriptlet tag ("<%").  I've tried everything I can think of, including removing all tags that start with "%" from the beautifier and extension options.  How can I get it to stop this?

Also, when I add a <script> tag, why does it indent to the end of the tag when I press enter, rather than to the normal tab stop position like it does for all other tags, and how do I get it to stop doing this?

Thanks,
James

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I turn off all auto insertion
« Reply #1 on: January 26, 2007, 03:05:24 pm »
Those items are controlled from Tools > Options > File Extension Setup. Select the html extension, then click Options, the click Tag Options. Select <Default Tag> and uncheck "Insert end tag automatically".

I can't say why <script> is behaving differently. By "indent to the end of the tag", do you mean the end of the parent tag? I'll do some more digging.

Out of curiousity, why do you not want the auto insertions? One of our core beliefs is that to be as productive as possible you should type as few characters as possible. So, we put a lot of effort into completions, syntax expansion, and other features to cut down on typing. Some of these do take some time to get used to. At first I kept typing extra parens inside of if statements because syntax expansion was putting in the if block for me. But I quickly discovered how much faster this made me. I'd love to hear your perspective.

--Scott

jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
Re: How do I turn off all auto insertion
« Reply #2 on: January 29, 2007, 05:54:06 pm »
Thanks, Scott, for your reply.  Unfortunately, I followed your instructions and it is still inserting the end tag.

Here is the indenting that is happening on the <script> tag:
<script language="JavaScript">
                              The next line starts here (after the close angle bracket of the <script> tag)


I'm having a similar problem with continuation lines, such as function calls that take up multiple lines.  I would prefer that all lines after the first be indented one tab stop, rather than align to the opening parenthesis.  For example, I want it to do this:

SomeFunction(param1, param2,
    param3, param4);


rather than this:

SomeFunction(param1, param2,
             param3, param4);


There are many features that I like about SlickEdit that make life easier.  But my main problem with auto insertion is that it interrupts the flow of typing.  I find they usually require me to move a hand away from the main typing area (to press an arrow or End key, or to use the mouse, etc.).  In truth, I haven't really bothered to learn if there are key combinations that don't require moving my hand away, and I don't really want to retrain myself to not type closing parentheses and braces.  Also, I often find that the formatting of inserted text is not as I want it.  For example, with the problem I originally described, when I type "<%" in a jsp, it immediately inserts a space and moves the cursor to after the space.  This is problematic because the majority of the time I'm trying to type "<%=" -- the space will cause compiler issues.  It's also undesirable to have the close tag placed on the following line, because I usually want to type something like "<%= someVariable %>"; I don't want an additional line.  Finally, I would rather just type the close tag "%>" than have to take my hand out of typing position to use the cursor navigation keys to get past the close tag; it's not that I'm lazy, I just hate moving my hand back and start typing only to find that it's in the wrong place and have to backspace over 5-10 characters, which defeats the point of not having to type those 2 characters in the first place.  In my opinion, a great code editor would suggest auto-completions, but it would never insert anything (except whitespace) unless I explicitly told it to.  I know SE can do this, but I don't use it because the popups are too close in proximity to what I'm typing; I would prefer it if the suggestions would pop up somewhere other than the editing window, so I could still see what is around what I'm typing.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I turn off all auto insertion
« Reply #3 on: January 29, 2007, 07:37:22 pm »
Thanks for the well-considered response. I need to think about your responses for the auto-completion and insertions and see how we might better integrate them so users don't have to move their hands. Their are options to cycle through with Tab and other things like that, but I don't think they are as consistent as they could be.  That's excellent feedback!

Sorry, you need to change the setting for the Script tag, not the <Default tag>.

As for the parameter indenting issue, select Tools > Options > File Extension Setup, then select the language mode in question. For javascript, select js. Then click the Options button. Put a check in "Use continuation indent on function parameters." There should be a similar setting for any language you are coding in. For JSPs, you can do the basic settings for the jsp mode (which refers to and inherits the settings for html). You need to make the settings for the embedded language, javascript, to the js mode.

As for the indenting, that seems to be a bug. I get 3 behaviors:
1) Setting to Syntax Indent (Tools > Options > File Extension Setup, Indent tag) indents to the column after the close bracket. This should be the one that just indents 4 spaces, or whatever you have set for that value.
2) Setting it to Auto, indents to the column of the open bracket, which seems reasonable.
3) Setting it to None, places the cursor in column 1 with no indent at all, which seems reasonable.

We won't be releasing any more fixes for 11.0.2 at this point. We have substantially changed the settings for XML/HTML formatting in v12, which should fix this problem. The best workaround I can suggest is to set your indent to Auto and then hit tab to do one indent level. That's fewer characters than deleting all those spaces.

jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
Re: How do I turn off all auto insertion
« Reply #4 on: January 29, 2007, 08:50:24 pm »
Thanks, Scott.  The tip on setting the continuation indent took care of the problem with function parameter lists.  I can live with the indenting problem after the <script> tag, since I usually only use it once per file.  I'm still having the same problem with the "<%" tags; I changed the setting on the script tag, but it is still auto inserting.  This is definitely a problem that is causing a lot of grief.

jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
Re: How do I turn off all auto insertion
« Reply #5 on: February 05, 2007, 10:40:04 pm »
Hi, Scott.  I'm still having trouble with it auto-inserting the close scriptlet tag "%>" when I type "<%".  Just wanted to make sure you haven't forgotten about me :)

Thanks,
James

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I turn off all auto insertion
« Reply #6 on: February 05, 2007, 10:49:01 pm »
I'm having a problem reliably reproducing this problem. Can you post a file that exhibits this problem? I want to be sure we're on the same page. Please indicate where in the file I need to type <% to get the problem. I'm less familiar with JSP than you.

Also, be sure to set the value for the % tag in JSP and HTML, just to be safe.


--Scott

jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
Re: How do I turn off all auto insertion
« Reply #7 on: February 08, 2007, 11:08:25 pm »
Scott, any file will do it.  When I create a new .jsp file and type <% on the first line, it will do it.  It will do it anywhere in any .jsp file.

JSP refers back to HTML, so when any changes I make to JSP also changes HTML.

Thanks,
James

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I turn off all auto insertion
« Reply #8 on: February 09, 2007, 07:46:48 pm »
I can't reproduce this issue with an empty file, as you describe. I've reset my configuration to a default config, and I still can't reproduce it. Can you try this on a default config? The easiest way is by starting SlickEdit with the -sc option: vs -sc "c:\temp\sctest"


jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
Re: How do I turn off all auto insertion
« Reply #9 on: February 12, 2007, 04:40:00 pm »
Scott, I tried what you suggested, and I found that it did not auto-insert the %> when I started it with the default config.  Once I turned off "Auto-list members" in the "Tagging" tab, it started doing it again.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2920
  • Hero Points: 438
Re: How do I turn off all auto insertion
« Reply #10 on: February 14, 2007, 05:05:47 pm »
At the time that the completion on <% was written, JSP didn't even have <%= expr%>, so it was completely logical for it to always open a new line.

Here is a fix for you:  edit slickedit/macros/codehelp.e and comment out the lines in the following function which I have commented out:

Code: [Select]
void auto_complete_script_block(_str last_key, _str current_key)
{
   if(last_key=='<') {
      // check to see if there is existing text on the line
      //_str textAfterCursor=_expand_tabsc(p_col,-1,'S');
      //if (textAfterCursor!="") {
         _insert_text("%>");
         _GoToROffset(_QROffset()-2);
      //} else {
      //   insert_line("%>");
      //   _GoToROffset(_QROffset()-3);
      //}
   }
}

As for the philosophical debate about completions vs. retraining your fingers vs. typing flow, keep in mind that when configured to match your coding style, SlickEdit's completions are designed to keep you in a convenient coding flow 90% of the time, and help you keep your hands away from the mouse and even the cursor keys.  It may be painful at first to retrain your fingers to not type things that the editor can do for you automatically, but you seem to have retrained your fingers to trust indention, so syntax expansion and other auto-completions are just the next step.  You may also want to try to train your fingers to use the "next-hotspot" command (Ctrl+[ in CUA emulation) in conjunction with syntax expansion to further easy your typing burden.

Another reason to use auto-completions is that they help the editor help you.  Suppose you type "if (expr) {".  Well, now your function has mismatched braces.  Likewise, if you type /*, and if we did not autocomplete it to /**/, you have just commented out perhaps thousands of lines.  Likewise, in JSP, you type <%, you have started an embedded code block that has no closing %>, so all the HTML and other text, either up to the end of the file or a mismatched >% is going to be interpreted as Java code.  The auto-completions help keeps the code in a managably correct state, which, like I said, helps SlickEdit help you.

jaubuchon

  • Community Member
  • Posts: 10
  • Hero Points: 2
Re: How do I turn off all auto insertion
« Reply #11 on: February 19, 2007, 06:01:18 pm »
Thanks, Dennis; that did the trick.  I am now happy  ;D

If we are having a philosophical debate, shouldn't the primary goal of an editor be to do what the user wants it to do, when he/she wants it done, in the way he she wants it done?  For example, I don't see the benefit in having the editor add a closing paren or brace when it would take at least the same number of keystrokes to get around it as it would to just type it (I still don't know what that ctrl-] is for; it just seems to move the cursor to the closing paren or brace, but BEFORE it, not after it; and it does nothing for jsp scriptlet tags).  Should I be forced to live with this?  Some find benefit in knowing that their parentheses and braces are always correctly matched.  I, myself, am pretty confident about whether or not a paren or brace has been closed the vast majority of the time (it has been well over a decade since I programmed anything in Lisp), and when I am not, a key combination comes in handy to show me the matching parens/braces, thus relieving me of the need to have them automatically inserted.

As for auto-completing comments (/**/) and embedded scripts, one thing I love about SlickEdit is how well it does color-coding.  If I type "/*", everything after it instantly turns green and is italicized.  Marvelous!  I know at a glance what has been commented out.  Likewise, when I type "<%" in a jsp, everything after it has a gray background (and, believe me, this is a big improvement over CodeWright, which had a hard time doing just that).

By the way, I've been programming for close to 25 years now.  I've used a lot of different code editors, and each one has required some retraining, for better or worse.  But I have never had to retrain myself to trust indention, because every code editor I've ever used has had some form of automatic indention when applicable.  Heck, even "vi" has some rudimentary auto indention.

I think it's wonderful that code editors (and especially SlickEdit) have evolved to have so many useful features that appeal to such a wide variety of users.  Just so long as I can turn them off  ;)  Thanks again, Dennis and Scott, for your help.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5149
  • Hero Points: 425
Re: How do I turn off all auto insertion
« Reply #12 on: February 20, 2007, 04:44:17 pm »
I like the way SlickEdit handles '/*' because IMO it's the best of all worlds.  SlickEdit automatically inserts the '*/'.  Here's the GREAT part (Thanks to Dennis):  If the '*/' is in the wrong locations who cares.  Just move the cursor to where you want it and type '*/' and SlickEdit will automatically remove the '*/' from '/**/'.  This same feature could be applied to other constructs. 

cycloptic

  • Community Member
  • Posts: 15
  • Hero Points: 0
Re: How do I turn off all auto insertion
« Reply #13 on: February 27, 2007, 10:06:01 pm »
You may also want to try to train your fingers to use the "next-hotspot" command (Ctrl+[ in CUA emulation) in conjunction with syntax expansion to further easy your typing burden.

Thanks for this, I never knew these "hotspots" existed. One of my main issues with code expansion and aliases is skipping past the expanded construct, which for me usually involves moving my hands to cursor keys.

Is it possible to define "hotspots" in aliases that the "next-hotspot" command will react to? Also, is it possible to define a hotspot after the last brace of a brace expansion to make it easier to skip beyond the expansion when appropriate? I see now that they seem to be defined for within the construct but not beyond.

For instance in the construct

Code: [Select]

for (|) {|
}


in a javascript expansion seems to have hotspots defined where the '|' characters are, but not after the closing brace.


cycloptic

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Re: How do I turn off all auto insertion
« Reply #14 on: September 15, 2007, 09:30:34 pm »
I don't know, maybe it's an old-timer thing (I've been programming 25+ years as well), but I completely agree with jaubuchon's assessment.  One of the things I have fought SlickEdit on for a long time is the battle between helping me and getting in my way.  I recently had the sad occasion to be forced to use Eclipse (for a week long training).  I noticed how much slower I was at getting things done, but I did learn one trick that I wish SlickEdit had, and it directly relates to this old discussion.

It performs a type of "paired symbol matching" (I'm not sure, it may only be active for automatically inserted symbols) so that I never have to worry about hotspots or jumping to the end of the line or grabbing my mouse.  Basically it works like this, if I type if( it automatically expands to (where | is the cursor):

Code: [Select]
if(|) {
}

If I continue to type anything but a close paren that matches the original open paren it simply inserts it at the cursor:

Code: [Select]
if(((value = getValue()) != null|) {
}

Notice, I have typed open and close paren's in there, but since none of them matched the original open paren, nothing new has happened.  But, when I press the close paren this time, it recognises that it matches the original open paren and just moves the cursor without inserting an additional close paren:

Code: [Select]
if(((value = getValue()) != null)| {
}

If I then press a space and an open brace, the same thing happens (which is why I think it may be specific to automatically inserted symbols):

Code: [Select]
if(((value = getValue()) != null) {|
}

I can press enter and move along with my coding, without ever having to worry about hitting Ctrl-End or Ctrl-] or pressing the -> key a bunch of times, but it never gets in the way of users that have trained themselves to work that way either.

I would LOVE to see this feature in v13 (or even better v12.0.4, but I expect it's more work than that would allow).  If you have any questions please don't hesitate to ask.  I have to say in 25+ years of programming, this is the best editor I've ever used, now let's make it better =8^)
  (*Chris*)