Ctrl-U "Go to Base"
The documentation says "Position the caret on declaration of any type and
use this action to navigate to its super types."
This works if I put the cursor on the "foo" in the declaration "class foo :
bar"
But if in some other code I declare "foo myFoo", and put the cursor on
"foo", nothing happens when I press Ctrl-U. I would expect it to take me to
the declaration of bar... no?
It seems right now, I need to do a Ctrl-Shift-T "Go to type Declaration"
first, and that seems like an unnecessary step. Am I missing something?
Please sign in to leave a comment.
Paul,
there is obviously an error in the documentation. Go to Base works in such a
way that it navigates to the
base type (or member) of the type (or member) inside which the caret is
currently positioned. So, if you're inside method foo.Method and press
Ctrl+U, you're going to navigate to the base method of foo.Method - that is,
the method that foo.Method overrides or implements. Notice that in fact
there can be multiple base methods (in which case you will be prompted to
choose the interesting one from the list), or no at all.
If you have a reference to foo like 'foo myFoo', you indeed need to navigate
to the declaration of 'foo' first.
Thank you for your report, we'll fix the error.
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:cd1qrs$v7q$1@is.intellij.net...
>
>
>
>
>
Doesn't that make Ctrl-U kind of useless? Or at least unintuitive?
I mean, I'd expect that if I put the cursor on the NAME of the method, and
hit it, that I would go to a base implementation of that method.
But if I'm on a type name, why can't it just go to the base of that type?
Requiring me to go to the type definition first seems to be useless, because
the base declaration is right there, and I can just move the cursor over,
and "go to type declaration" again to have the same effect.
Ctrl-U doesn't seem useful unless it goes to the base of whatever identifier
the cursor is currently on. Whether it's "inside a method" seems rather
irrelevant to me.
In short, I'd say the documentation is correct, and the implementation is
not, and I'd rather the implementation change than the documentation.
"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:cd2q9c$36f$1@is.intellij.net...
>
a
is,
navigate
>
>
and
foo
me
>
>
It's rather common situation when you need to jump to the base method while
editing the body of the implementation. Can you provide a usecase when you
need to jump to the base method while on positioned on a call to the derived
one?
--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com "Develop with pleasure!"
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:cd3ia3$ge7$1@is.intellij.net...
>
>
>
because
>
identifier
>
>
such
to
Declaration"
something?
>
>
That's not the point. The point is wanting to see the base method for a
TYPE, and you happen to be on the type right there within the method. If
you want to go to the base method, you can always just jump up to the top of
the method and invoke Ctrl-U. It just seems that "Ctrl-U" should be
consistent in its behavior, and that it seems intuitive that the behavior
should be "go to the base of whatever the cursor is on". Sure, going to a
base member is useful, but what I'm saying is that going to the base type
declaration is pretty useless, since you can simply move the cursor over a
few characters (past the colon) and invoke go to definition. There's just
an inconsistency in the fuction of this keystroke that is unintuitive. It
seems to me it should either go to the base of whatever the cursor is on, or
it should ONLY go to the base method implementation of whatever method the
cursor is in (i.e. "go to base method"), and something else could "go to
base type" from whatever the cursor is on. The mixing of the two seems...
unsuccessful.
Do you see what I mean yet?
I'm also having tons of problems with "Go to inheritor" not working. I'm
sure it's probably the assembly reference thing again, but it just seems
broken to me when I have all the projects loaded up in the solution, and the
base class and the derived class loaded in the editor, all visible clearly
to me, and yet when I put the cursor on an type name and say "go to
inheritor", it says "there are no inheritors", when clearly there are.
I really hope you're going to put support for assembly references in ASAP
because it really limits the usefulness and usability of this otherwise
excellent tool without it. In fact, it makes many things "dangrous"
(refactorings only fixing up SOME references, and a "find usages" stating
there are no usages (i.e. it's safe to delete or rename) when there probably
are). Just my two cents. I mean, it's fine as it is for small,
self-contained projects that one developer is working on, but in the real
world of complex projects, and dozens of developers working independenly, it
seems problematic at best.
I put this here because it seems more often than not, things "don't work",
as I put my cursor on something and say "go to base" and it doesn't go to
the base... it goes somewhere else, or I put my cursor somewhere and say "go
to derived" or "find usages" and it says no such thing exists or nothing
happens. It's been frustrating. Please tell me version 1.1 will address
some of these issues, as I'd love to recommend this tool to everyone I work
with. Right now, I can't.
"Valentin Kipiatkov" <valentin@jetbrains.com> wrote in message
news:cd5c18$jbn$1@is.intellij.net...
while
derived
>
>
and
type?
over,
is
is
that
fact
type
"class
on
take
>
>
I agree with you in most points, especially about goto base/derived. Simply, goto base, goto derived are not symmetric and consistent. We've spoken a lot about this issue with the team, but not agreed on anything. I believe that "goto" family should be based on caret position, i.e. identifier under caret, not enclosing construct.
From the other hand, I see it can be useful to go to entity related to enclosing construct, but this should be different feature, list both base and derived methods/classes (with appropriate icon) and allow to jump to any entity in the hierarchy instantly.
Another topic that was discussed (in tracker & private messaging) is "goto implementation" feature. I.e. positioning caret on the method call or property access you could see the list of all implementation you can hit. Using such feature you could answer the question "what code can execute if I call this" instantly. Again, this is completely different feature.
I completely agree. All that would be very nice.
"Ilya Ryzhenkov" <no_mail@jetbrains.com> wrote in message
news:12661370.1089984897399.JavaMail.itn@is.intellij.net...
Simply, goto base, goto derived are not symmetric and consistent. We've
spoken a lot about this issue with the team, but not agreed on anything. I
believe that "goto" family should be based on caret position, i.e.
identifier under caret, not enclosing construct.
>
enclosing construct, but this should be different feature, list both base
and derived methods/classes (with appropriate icon) and allow to jump to any
entity in the hierarchy instantly.
>
implementation" feature. I.e. positioning caret on the method call or
property access you could see the list of all implementation you can hit.
Using such feature you could answer the question "what code can execute if I
call this" instantly. Again, this is completely different feature.