Toad World® Forums

ctrl + mouse click navigation within package body


#1

When I’m currently editing package body XXX, and I CTRL + mouse click on the function / procedure which is defined within the same package XXX, the cursor should not go to the package specification, but rather stay in the package body.

(if the function / procedure is defined within some other package then it is fine to open that package and focus cursor to the package specification)


#2

Hi rbo_906,

It’s a valid enhancement request. We will raise a CR and consider it for 6.4. In the meantime, please use Ctrl+Shift+Up/Down to navigate between declaration in the spec and implementation in the body.

Regards,
Roman


#3

Actually, I’ve just tried it and found that it already works the way you suggested. Can you send us an example when it doesn’t work like this?

Thanks,
Roman


#4

Hi Roman

I also would like that funcionality to work that way.
Here is an example:

CREATE OR REPLACE PACKAGE a2
IS

procedure b;
PROCEDURE b1;
PROCEDURE b11;

END;
/
CREATE OR REPLACE PACKAGE BODY a2
IS
PROCEDURE b
IS
BEGIN
DBMS_OUTPUT.put_line (‘Hello’);
END b;

PROCEDURE b1
IS
BEGIN
    a2.b;
END b1;

PROCEDURE b11
IS
BEGIN
    b;
END b11;

END a2;
/

If I cntrl+click the unqualified b (in b11 procedure) it will get the cursor to the beginning line of the definition of the procedure b in the body.
If I cntrl+click the qualified b (in b1 procedure) it will get the cursor to the beginning of the package body.

Regards
Filipe


#5

Hi again

BTW: if you use a forward referencing and click on a call for it (unqualified) if it get you to the forward reference. is there any fast acess to the “real” definition.

example:

PACKAGE BODY a2
IS

FUNCTION f (a IN INTEGER)
    RETURN INTEGER;

PROCEDURE b
IS
    l_f   INTEGER := f (0);
BEGIN
    RETURN;
END b;

FUNCTION f (a IN INTEGER)
    RETURN INTEGER
IS
BEGIN
    RETURN 1;
END f;

END a2;

Thanks
Filipe


#6

Hi Roman,

It doesn’t work if the procedure in the package body is fully qualified, ie:

We are working in a schema = SCOTT, package name = TEST

Now in the package body:

  • P_EXEC takes me to the P_EXEC procedure in the package body - WORKS
  • SCOTT.TEST.P_EXEC takes me to the specification - NOT OK (we are in the same package, so take me also to the package body)

Thanks.


#7

Hi Roman

rbo_906is right!
So:
1- if qualified with user.package.* goes to the definition point in spec
2- if qualified with package.* goes to the beggining of the body

only works when not qualified (with user or package_name)

Regards
Filipe


#8

Hi,

You are right. But my question is: why do you need to qualify the call to a procedure within the same body? I can see only one bug here: when procedure name is qualified only with package name, it goes to the start of the body. The other case is questionable. When you qualify procedure with schema.package, aren’t you referring to the specification, rather than implementation, of the procedure?

Regards,
Roman


#9

Hi Roman

My team never qualifies with because that would make it installation specific (if in another schema we use synonyms)

We qualify with package.* because sometimes the unit is defined after the current unit (but is in the spec).

I really am not sure if going to a forward referencing (in the package body) and apparently without a fast way to go to the definition is the correct lookup location.

(BTW via Outline we can easily spot the forward referencing and the “real” definition but with code explorer tree we cannot spot that)

Regards
Filipe


#10

I guess I don’t need to, it’s just a coding style / preference, when it’s possible why not? And why not add just a check if we are in the same package focus to PKG BODY.