Author Topic: How to jump to next block of code?  (Read 1964 times)

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
How to jump to next block of code?
« on: May 09, 2015, 01:08:30 pm »
Hi Expert,
     when I edit tcl file in slickedit, after type "for" and then <space> , slickedit will automaticaly append {} {} {}, and move the cursor into first {}, but I wonder how to quickly jump to next {} , I try to type <tab> , but it doesn't work.  any one could help to comment?  by the way, I am using VIM emulator.

Thanks & Best Regards,
Lusu

hs2

  • Senior Community Member
  • Posts: 2733
  • Hero Points: 285
Re: How to jump to next block of code?
« Reply #1 on: May 09, 2015, 01:51:07 pm »
'next/prev-hotspot' (there are visible markers for them) are the commands to navigate in auto-inserted code. Check/adapt your Key Bindings.
HS2

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Re: How to jump to next block of code?
« Reply #2 on: May 10, 2015, 01:55:56 am »
Hi HS,
     in TCL, there is no marker for for {} {} {},and the hotspot doesn't works too, you can try by edit a dummy tcl file. but  in c/c++, it  works well.

Thanks,
Lusu

hs2

  • Senior Community Member
  • Posts: 2733
  • Hero Points: 285
Re: How to jump to next block of code?
« Reply #3 on: May 10, 2015, 06:46:02 am »
Hi lusu2004,

you're right. SE TCL mode currently doesn't support hotspots. I've even verified the (latest release) sources.
Shouldn't be too hard to add hotspots to TCL as well. You should file an official change request.
HS2

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Re: How to jump to next block of code?
« Reply #4 on: May 11, 2015, 12:48:01 am »
Hi hs2,

     That is great ! looking forward to get a fix , by the way, how to file an official request? (I had buy a license for 19 months ago, and I am currently using 19.0.2.5)

Best Regards,
Lusu

hs2

  • Senior Community Member
  • Posts: 2733
  • Hero Points: 285
Re: How to jump to next block of code?
« Reply #5 on: May 11, 2015, 06:47:41 am »
There is a web interface here https://customer.slickedit.com/support/opencase (for registered users)
HS2

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2496
  • Hero Points: 362
Re: How to jump to next block of code?
« Reply #6 on: May 12, 2015, 09:47:55 pm »
As a workaround, you can define your own alias for "for" that has hotspots.

1) Go to Document > Tcl Options... > Aliases.
2) Click + to add a new alias.
3) Name it "for"
4) Use the following alias definition.
Code: [Select]
for {%\c} {%\c} {%\c} {
%\i%\c
}

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Re: How to jump to next block of code?
« Reply #7 on: May 15, 2015, 05:30:08 am »
Hi dennis,

     Really cool, I add the alias, it works perfect.

     but I meet another problem, when I want to jump into next {} by press Tab, sometimes,
the auto-complete scheme will force me to do unexpected selection.
e.g.
     for {set i 0} {$i < [llength $mylist]} {incr i} {
     }
     after I type "incr i" , sometimes (or after a second) slickedit will show a list for selection (
    in the list, there are if/imagine/incr ... etc, I believe it is for automatic completion), then if I want to jump to next {} by type "Tab", slickedit will select "if" , so the codes become {incr if},
Is there any solution to fix this issue? 

Thanks in advance!

Best Regards
Lusu

hs2

  • Senior Community Member
  • Posts: 2733
  • Hero Points: 285
Re: How to jump to next block of code?
« Reply #8 on: May 15, 2015, 05:58:06 am »
You can also tweak your 'Tools > Options > Languages > All Languages and/or Tcl > Auto-Complete' settings e.g. to avoid auto-insertion of code on 'Tab' ('..inserts longest unique prefix') and choose 'Space' instead.
'Tab' is one of the few basic keys with special handling for some features. So alternatively you might choose just another keybinding for 'next-hotspot' (guessing you bound 'Tab' to this command).

Good luck, HS2

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Re: How to jump to next block of code?
« Reply #9 on: May 15, 2015, 08:25:56 am »
hi hs2,
    Thanks for your comment! I take a look at the key binding, find I just bind ctrl+N for next-hotspot, and ctrl+N is the only key bind to next-hotspot, and I try ctrl+N, it really works. so I am little bit confused. may just as you mentioned, Tab is the basic key already also bind to next-hotspot by default.
    and I am also worried about if I change <Tab> to <space> for auto completion. I may still meet trouble when type "set i $j" in tcl since there is a spacing right after i.  (in c, please think about statement i = j).
    it is really headache to me! :-)

Thanks
Lusu


   

hs2

  • Senior Community Member
  • Posts: 2733
  • Hero Points: 285
Re: How to jump to next block of code?
« Reply #10 on: May 15, 2015, 10:02:30 am »
Just try the various settings and find the best match for you.
The good thing is that you can configure SE a lot :)
HS2

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Re: How to jump to next block of code?
« Reply #11 on: May 15, 2015, 01:24:34 pm »
Hi HS2,

    Yes, agree, SE is very user friendly to configure!

    by the way, I try to change the "Tab" to "<Space>" for insertion of longest prefix in auto completion in configuration. but seems <Space> always insert space , I thought this is another bug in SE (19.02.05):-(.
   so the only way works to me is Still use "Tab" to insert the longest prefix, but "CTRL+N" for next hotspot.
   
Thanks
Lusu

hs2

  • Senior Community Member
  • Posts: 2733
  • Hero Points: 285
Re: How to jump to next block of code?
« Reply #12 on: May 15, 2015, 02:00:56 pm »
Is it again TCL specific and works for e.g. C/C++ ? I can't try it myself at the moment..
However, you should also send a problem report that they know about it and can fix it.
HS2

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2496
  • Hero Points: 362
Re: How to jump to next block of code?
« Reply #13 on: May 15, 2015, 05:07:19 pm »
Perhaps the documentation for "Space inserts longest unique prefix" could be a bit more thorough. 

When that option is enabled, space only inserts the longest prefix when you have something selected in the list already.  That way SlickEdit knows that you are hitting space because you want a completion, and it isn't just an incident where auto-complete just came up and you typed space anyway (not intending to get a completion).

Try hitting Cursor-down to select an item in the auto-complete list, then hit space to complete the longest unique match, and you'll see what I mean.

When the option is not enabled, hitting space will insert the currently selected item.

BTW, this applies to the "Manually choose completion" completion option.

lusu2004

  • Community Member
  • Posts: 39
  • Hero Points: 1
Re: How to jump to next block of code?
« Reply #14 on: May 16, 2015, 02:07:36 am »
Hi Dennis and HS2,

     Thanks a lot, I understand it now!! I have other questions about auto completion, but I am going to submit a new topic since I am not sure if it relate to jumping between code blocks.

Thanks
Lusu