Author Topic: How do I get SlickEdit to stop completing my syntax?  (Read 8963 times)

cmoore

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
How do I get SlickEdit to stop completing my syntax?
« on: March 24, 2008, 08:35:22 PM »
I've recently started using SlickEdit for C development.  I mostly like it, but I've
got one complaint.  I don't like the fact that when I type in "if " it fills in the following
"()".  I've spent over 20 years typing those parentheses after an "if" statement -
I'd rather just type them myself.  I don't want SlickEdit to put them in for me.

I've tried every option setting I can find.  I've completely turned off auto-completion.
I've turned off syntax expansion.  But I still get the () after my "if".  Also, when I type
the { it fills in the }.  That's nice.  But it also puts a blue box around the box.  Now if
I hit "down arrow" the box expands.  I understand the concept, but to me the "down arrow"
should move my cursor down a line.  I don't want it to expand the {} block.

If anyone has any suggestions about how to turn these features off I'd appreciate it.
I'm running SlickEdit version 12.0.3.0

Thanks

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #1 on: March 25, 2008, 01:05:02 AM »
The parens and braces is "Syntax expansion", the bottom left checkbox on the "Indent" page of the "Extension Options" dialog.  The setting is remembered separately for each family of related extensions.  The blue box is "Use Dynamic Surround", which is the checkbox immediately above it.  Try turning both of those off -- does that get you to the behavior you want?  (If so, then you might be able to turn the Auto-complete stuff back on, since it's not related, unless the Auto-complete stuff was also getting in the way).

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #2 on: March 25, 2008, 07:18:33 PM »
@cmoore: looks like you got what you needed. You might want to spend a little time and see if you can adapt to these features. They will save you keystrokes and allow you to type code faster.

Many of the features in SlickEdit are designed to save you from typing the boilerplate code, the interstitial tissue that doesn't really contribute to the unique functionality of what you're writing. Using these features plus things like completions, aliases, and code templates can not only save you time but make the coding process more pleasurable as you focus on what the code needs to do.


Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #3 on: March 26, 2008, 12:21:55 PM »
One thing you can do is use "shift space" instead of space  - this will result in a space character being entered with no special expansions.  You probably don't want to do that all the time but it's handy to know.

You can also define your own alias expansions  - see Tools -> options -> aliases.  For "C", select the c.als item.  See the help item "extension specific aliases" for how to create an alias (click new, enter the alias name, enter the alias expansion in the right hand edit window).  e.g. if you create an alias with the name of "if" and expansion text as below
Code: [Select]
if (%\c   )
{
}
then typing "if" followed by a space will produce text that has 3 space characters between the parentheses, with the cursor immediately following the left parentheses.  If you don't want any extra characters, just enter expansion text of "if ".

For dynamic surround, if you wanted to keep dynamic surround enabled but with cursor-down doing its normal thing instead of expanding the blue box, you could comment the lines below in surround.e  - you'll find these at approx line 1993 in surround.e.  After changing the code, you need to load the modified file  - use module load on the macro menu to compile the surround.e file.  "cursor-down" is the name of the command that the "down" key is bound to (rather than the name of the key itself), so whatever key you have cursor-down bound to will have the special processing in the do_surround_mode_keys function.  Therefore, instead of commenting the code below, you could change the name "cursor-down" to "my-surround-cursor-down", then write your own my-surround-cursor-down macro and bind a key to it (e.g. alt shift down)  - then you can use alt-shift-down to still get the "box expansion" in dynamic surround.

Similar to shift-space, there's also shift-enter which is the same as pressing enter but all the special processing (such as comment wrapping) is inhibited.

Once you get used to syntax expansions though, you won't want to be without them.

Graeme


// code from surround.e line 1993
Code: [Select]
         case 'cursor-up':
            if (first_time && gSurroundMarkerNumStartLines==0) break event_loop;
            num_lines = get_num_surround_lines(-1);
            unsurround_lines(start_line, end_line, num_lines, p);
            continue;
         case 'cursor-down':
            maybe_delete_blank_line(first_time, start_line, end_line);
            num_lines = get_num_surround_lines(1);
            surround_lines(start_line, end_line, num_lines, p);
            continue;

cmoore

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #4 on: March 27, 2008, 05:43:32 PM »
Thanks for the help, that was exactly what I needed.

I understand that this is a feature, and that many (most?) people would want it turned on.
I can see how it saves time once you're used to it.  For me, though, I have 20 years of
habit to overcome.  When I think "if statement" my fingers type "if (".  When SlickEdit has
already put the "(" there for me I have to realize it happened, stop, and back up to delete
the extra "(".

I think you've got the right solution - come up with features that help most people, turn
them on by default, but have an option to turn them off if someone doesn't want them
for some reason.  In this case the only problem was that I didn't know what the feature
was called and how to turn it off.

Chris

Ryan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 986
  • Hero Points: 77
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #5 on: March 27, 2008, 06:43:55 PM »
Quote
When I think "if statement" my fingers type "if (".  When SlickEdit has
already put the "(" there for me I have to realize it happened, stop, and back up to delete
the extra "(".

Wanted to pop in here to say that if you spend the time to really learn SlickEdit, and get used to taking advantage of things like syntax and alias expansion, you will be so thankful for it down the road.  What you describe there is something all of us struggled with at some point, but it is worth it.  It took me a couple weeks to get used to dynamic surround, and now I would never work without it.

- Ryan

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #6 on: March 27, 2008, 08:16:55 PM »
Mm, yes, I believe that getting used to syntax completion will help me.

However, there is a weakness in the current implementation in SE 2007, in that it assumes one formatting style for all files in a particular family of extensions.  I'm hopeful that Adaptive Formatting in SE 2008 will address this (and I'm about to download 2008 and install it in a few minutes).  I regularly work in something like 15-20 different code bases with different formatting/style rules.  SE 2007's approach to style is too restrictive and actually hurts my ability to generate code, because 60+% of the time I have to edit the stuff that got auto-inserted.  I'm off to dig into SE 2008 now.  I might have more detailed feedback in a couple weeks...  ;)

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #7 on: March 28, 2008, 01:54:21 PM »
Sure, that makes a lot of sense. If Adpative Formatting isn't picking up enough of your settings, you might consider writing a macro that sets the appropriate values for each unique code style. Then in Project > Project Properties, select the Open tab and invoke the macro there. You may find this useful anyway, since Adaptive Formatting won't help you on new files.

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #8 on: March 30, 2008, 08:25:06 PM »
Quote
You may find this useful anyway, since Adaptive Formatting won't help you on new files.

Maybe there is a new feature there that needs to be added - a way to copy the formatting from another file when you create a new file.

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 36
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #9 on: March 31, 2008, 01:37:44 PM »
Quote
Maybe there is a new feature there that needs to be added - a way to copy the formatting from another file when you create a new file.

We do have something similar - Adaptive Formatting does have a "manual" mode.  You run the command 'adaptive-format-stats', which will run Adaptive Formatting on the file.  Then you'll get the pop-up window of results.  At the bottom is a checkbox that will allow you to save these settings for that language.  From then on,  any file of that language (including new files) will use those settings. 

I'm not sure if that's exactly what you want, but it's something that we already have in place now.

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #10 on: March 31, 2008, 08:21:56 PM »
Not quite what I had in mind.  I have to deal with a huge number of different ways of formatting in files, as I am mostly doing maintenance on legacy code at the moment.  When I create a completely new file (which is rare), I prefer to use my own defaults.  But when I need to create a file to go into an existing program, I need to get it to match that program.  If I find the time, I am sure I can take a look at adaptive-format-stats and work out how to write a macro to do that.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #11 on: March 31, 2008, 08:34:52 PM »
Hey, StephenW, now you're confusing me. Your earlier post suggested a feature that would copy settings from another file when you create a new one. In your most recent post you say that you want the editor to use your defined settings for new files.

Adaptive Formatting should be set up to work the way you want. On existing files, it will scan them and determine the settings that were used. On new files it will use your settings. What we are missing for chrissant is to have a way to set the formatting options on a per project/workspace level so he can have settings that match different code bases' code standards.

Please correct me if I'm mistunderstanding what you're saying. I really want to understand this so I can record any needed changes.  Thanks!

StephenW

  • Senior Community Member
  • Posts: 197
  • Hero Points: 21
Re: How do I get SlickEdit to stop completing my syntax?
« Reply #12 on: March 31, 2008, 08:48:33 PM »
If you let adaptive formatting set your defaults for new files for a language, it will set them to what is in an existing file.  That is good if you are wanting to copy the settings from an existing file, to add a new file to an existing project.  But if you are starting a new project, what you want is your own preferred setup for that language.  Letting adaptive formatting set the defaults for a language will overwrite your personal preferred settings.  So ideally what I want is for the "New file" commands to have an option to select another file, run adaptive formatting on it, and copy those discovered settings directly to the new file, leaving the stored default settings unchanged.