Function Definition Jump

Started by Arthur, March 16, 2009, 03:27:01 PM

Previous topic - Next topic

Arthur

Does that make sense to add a jump to function definition?

One would be able this way to quickly access a function definition (say by right clicking on the function name).

Stefan

yes this would be nice.

I would do this on my own if only scripting would be available :D

var = getWordUnderCursor
Find "Function " & var

-

I want also to see the very first occur of an var

like:
vPOSx = getX
vPOSy = getY
vWord = getWordUnterCursor
GoTo {TOF}
FIND vWord
MsgBox "Click OK to go back"
setX = vPOSx
setY = vPOSy

--

or i'd like to check if all vars are in DIM area too.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hi,

yes idea is not bad, but this is not possible in generic way. HE could not know what is a "function" and where is a "function definition". This is even more complex for variable definition.

And what if function is defined in another file? What to do with functions which have same name but different signatures?
To have full support of such functionality you need language oriented IDE or special plugin for HE. Or script maybe.

But easiest things are possible:
If function definition defined as label, then calling of Smart Navigate (Alt+G) on function usage in the code would jump to label with appropriate name (ehich is a function definition).
This is already possible, and I think should work for VB schema. Try it.

Jumping to first occurance of word on Smart Navigate when all other jumps are not possible is a good idea. I would put this in my todo and maybe would implement next betas.

Best regards,
Alex 
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Arthur

QuoteIf function definition defined as label
I am not quite following what the above means...

alex

Check basic_spec.xml part LABELS:
    <LABELS>
      <Label group="Subroutine" match="\&lt;(public|private)?\s*(sub|function)\s+(\w+)\s*(\([^)]*\))" name="\3" descr="\2 \3 \4" image="5" scope="1">
        <Image if="\2" equal="sub" value="8"/>
        <SubImage if="\1" equal="public" value="1"/>
        <SubImage if="\1" equal="private" value="3"/>
      </Label>
    </LABELS>

The label, is some part of the code that can be referenced from another part of the document (see more detailed description here) and shown in Navigation Bar, Hierarchy Bar, Scroll Info etc. Labels can be described with regular expressions and generally can be any part of the text. But particulary in vb case it is function and subroutines definitions.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Beta 1.42 Build 637

Added. Jumping to first occurrence of the word in current top level scope on Smart Navigate.

(means: put cursor inside an word and press Alt+G to go to place where this word is used first time.
Or if you want: set anchor with F7, the use Alt+G, then use Ctrl+F7 to go back to anchor.
Hint: to jump from occurrence to occurrence of an word use Ctrl+F3/Shift+Ctrl+F3)
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Stefan

Quote from: Stefan on March 30, 2009, 09:17:15 AM
Beta 1.42 Build 637
Added. Jumping to first occurrence of the word in current top level scope on Smart Navigate.

While using this new feature ... i see it didn't works always.

EDIT: i think i found an issue: this works for me only inside an block?
I have an Block "On Error Resume Next"  to set an bgcolor to my likely.
If i use ALT+G i found only the first occurrence within the same block (as far as i have test it)
If the word would be one line above / outside my block it isn't found.

099 myword
100 On Error Resume Next -block
101 myword
... ...
657 myword --- ALT+G goes only up to line 101, not to line 099


I work with an syntax which i am currently test too.
I have this in my syntax:

  <Style id="ErrHand" name="ErrorHandling" text="1" bold="0" italic="0" underline="0" clr="#000000" bkclr="#eeeeee">
        <Blocks>
          <Block open="On Error Resume Next" close="On Error GoTo 0"/>
        </Blocks>
      </Style>



Note, I have an Scope too in this syntax
<Scope open="On Error Resume Next" close="On Error GoTo 0"/>



AS far as i see/understand:
- Block is used for style, here for setting colors.
- Scope is for folding.
Am i on the right way? :D
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hi Stefan,

the logic on Smart Navigate is follwing:
when noting else found HE goes to first occcurence which is
- in same top level scope (block)
- has same style (to skip matches in strings and comments, if done in code)

Next:
Styles used for a lot of things, but main purpose is syntax highlighting. Also they used for defining Containers to limit some othr styles or scope or labels (this is in FAQ also). If style switches syntax (embed syntax) it also used for folding.

Scopes used for folding. Mostly. But also for some other things, where it can be logical. For example to limit some actions as search for first occurence or open/close brace.

Regards,
Alex
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Oh  ::)
Then it works as indented  :'(
(i thought i could jump to the first occurrence in doc and find out if i had DIM my VAR. OK, waiting for scripting :D)

Thanks for clarifying!
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hello Stefan,

I got an idea, that could help you :)

First Smart Navigate goes to first occurence of the word in the 0-level block (as it now).
But if you call it once more, it goes to first occurence in the document. I think it is not difficult to press Alt+G twice ;)

Would be added in next beta.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Quote from: alex on April 29, 2009, 01:04:15 AM
Hello Stefan,

I got an idea, that could help you :)
Upps? Thank you!

Quote
First Smart Navigate goes to first occurence of the word in the 0-level block (as it now).
But if you call it once more, it goes to first occurence in the document.
>it goes to first occurence in the document
GREAT.


QuoteI think it is not difficult to press Alt+G twice ;)
That's pretty fine :D
Thanks

Soon i can use
-- 'Alt+G' twice to find first occurrence of word under cursor
-- then 'Navigate backward' assigned to 'Alt+Shift+G' to go back where i came from



Stefan
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

urlwolf

what if the symbol is defined in another file in the project (which is good practice)?
Would HE jump to the right file?
For that, you may want to use ctags.
Works well for most filetypes.

also, do we have a list of functions on each file? How? I couldn't see it in the project mode
Thanks

alex

QuoteWould HE jump to the right file?
No. Support of ctags is in plans, but woul be done when plugin support would be added.

Quotealso, do we have a list of functions on each file? How? I couldn't see it in the project mode
There is no special pane for it. In HE function list currently represented as Navigation Bar, shown on top of editor window.
Navigation Bar shows list of labels (described as regex) from document. So the szntax should have them defined and you need to enable Navigation Bar in menu View->Panes.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]