Author Topic: auto-close "<"  (Read 3641 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
auto-close "<"
« on: September 16, 2014, 08:55:10 PM »



auto-close of "<" doesn't work.
In Options->Lang->C++->Auto-Close
I have "Enable" checked, and all brace types are checked.


All the different brace types work for me except for "<"

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: auto-close "<"
« Reply #1 on: September 16, 2014, 09:12:24 PM »
Where isn't it working for you?   There are only certain contexts where the auto-close for '<' can work, like after an #include, or after the template keyword.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: auto-close "<"
« Reply #2 on: September 16, 2014, 09:51:06 PM »



I'm talking about the case where you select some text, then type a {, [, ', ", or (.
The selection is surrounded with a matching pair



 [/size]With "<", I can't get it to work at all.
If I type this:
[/size]#include stdio.h[/size]then select "stdio.h", type <, and I get[/size]
#include <>

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: auto-close "<"
« Reply #3 on: September 16, 2014, 10:19:56 PM »
This particular feature has nothing to do with the auto-close feature.

I took a quick look and it doesn't have support for <>. This is a new features of course and we can easily add it. I did noticed that the selection is off. I'll look into that bug.

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: auto-close "<"
« Reply #4 on: September 16, 2014, 10:54:19 PM »
If we did add a GUI for this feature, the options would be with the Auto-Close options ("Auto Surround Selection").

Clark

  • Moderator
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: auto-close "<"
« Reply #5 on: September 16, 2014, 11:17:46 PM »
This is fixed in the next beta. Eventually we need to add language specific options for this feature.

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: auto-close "<"
« Reply #6 on: September 17, 2014, 04:35:49 PM »
Not sure if this is related but I just came across something like this with Beta 5 (Win7x64)

I had a line like
Code: [Select]
#include "fred.h" and decided I needed to change out the quotes to "<", so I went to the beginning of fred, deleted the " and typed '<'  the autocomplete kicked in but it "overwrote" the fr of fred with "<>"  If I start typing or hit escape, fred.h was pushed out to after the "<>".

Now doing the reverse of this (converting "<>" to quotes) does NOT do any auto complete or insertion at all!  The singular quote just appears!

One thing I (erroneously) assumed would happen here is that it would behave like the "{" inclusion and auto-surround the text for the include by hitting the right arrow.  I think I've just grown so accustomed to the bracing surround feature that I'm expecting it in other places now where it never did before. 
Although I wonder if you don't want to just disable "<" autocomplete here altogether and just have it act like the quote behavior?
« Last Edit: September 17, 2014, 04:38:58 PM by skywise »

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: auto-close "<"
« Reply #7 on: September 18, 2014, 09:59:48 PM »
I'm putting in a few fixes to make the quote / angle bracket conversions for #includes work correctly.  I was not able to reproduce the conversion overwriting the filename as you described, but the new code is more strict, so it shouldn't have problems like that.

Now, if you have #include "fred.h" just putting your cursor on the quote and typing "<" will convert it to a system-header style angle-bracket include.  Conversely, if you have #include <fred.h>, just putting your cursor on the opening quote and typing " will convert it to a nice quoted include.

Common C/C++ misconception:  Quoted #include's only look in the current directory or path relative to the current file.  In fact, they also search the include path (-I), but they do not search the built-in compiler search path for system headers.

Helpful C++ hint.  Use quoted #include's whenever referencing your own headers (as opposed to compiler or third party headers).  Then you will be less likely to pick up a like-named system header and the compiler won't fool around searching system directories for #include's that are definitely not what you are looking for.