-
Notifications
You must be signed in to change notification settings - Fork 618
Make Go to Symbol commands show symbol type/signature in list #3475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When there is more than one matching symbol. For variables, show type. For callables, show (at least) parameter list. Show non-first item using italic `file:line:`.
I'm late to complain, but using this for a couple hours I find it a bit annoying with long C++ signatures. I got many cases where the popup now spans most of my screen width, making the thing a bit hard to use quickly. Also, although useful, the signature is so big and prominent that the filename is almost buried and harder to find; and many times I have the same signature because it's just all implementations of an interface, so the signature itself is not that interesting in that case. I didn't test the tooltip version, but I'd guess I'd like it better, what was the reasons for you to abandon it? Maybe we could find a middle ground :) |
Oh sorry. Perhaps I could add a preference:
Or perhaps limit the length of each item? BTW I'd like to do something similar for calltips - show a list of overloads rather than having to click the down arrow 10 times to find the one I want. Unless clicking the arrow shows the list and selecting an item collapses it. |
oooh, @b4n using C++, there is hope yet 😄 I didn't get a chance to try it yet, but it sounded like a good idea, just file:line isn't much help selecting between function overloads. But I can also see what @b4n is complaining about. Personally I can't see file:line adds anything if scope and signature are shown so I would just do the second, with the tooltip for edge case situations like the exact same function being implemented more than once (with |
Because looking for a signature is far more common for me than looking for file and line. |
I made #3495 to limit the width, does that help?
With that pull, the width shouldn't exceed the editor widget, so you can look for the filename on the left of the popup. |
Whats the point of showing file:line? The goto symbol will go to it, and if the user knows file:line they won't be using goto symbol, what is important is to be able to select the correct version of the symbol to goto. |
I'll give it a try, thanks
Well, I myself very often use the goto feature as a quick way to go where I want, even if I know the file (yet, usually not the line). And most of the time I do know the file I want, actually more often than the signature (as again, very often it's interface implementations rather than overloads, so the signature is the same -- yet, the namespace/class is usually not) |
Well, goto declaration vs goto definition is supposed to separate the interface from the implementation, but I havn't actually evaluated how well that happens. |
@elextr it mostly does, but that's not my point. My point is that if you have an "interface" implemented by several classes: class Iface {
public:
virtual bool maybeDoSomething(int n) = 0;
};
class Foo : public Iface {
public:
virtual bool maybeDoSomething(int n) override { return n == 42; }
};
class Bar : public Iface {
public:
virtual bool maybeDoSomething(int n) override { return (n % 42) == 0; }
};
Having the signature is fairly irrelevant: it's gonna always be the same. What's interesting is the symbol name and scope, and as that'll usually be spread in different files, the source file isn't useless. Having the signature is useful when having overloads, not really for overrides. |
BTW, this is giving weird results when going to anything that doesn't have a tooltip (e.g. anything that doesn't look like a callable), e.g. a type. Especially weird when called on a class name, as it'll look something like this, mixing names and nothing:
There should at least always be the fully qualified name on the right if we want to display something. |
Ahh, what is shown as the signature of the two implementations in in your example, I don't have the PR applied? I would have thought they would be |
It wouldn't, that's what I wrote (emphasis mine):
|
Anyway, I would have to try and use it without the file and line and see if I can adapt to it, so I can have a better idea of whether the file really is useful or just a habit I have. |
Maybe we have a different understanding of "signature", in my mind its the whole type, return (remember an override can be any covariant type, its not necessarily exactly the same as the
I mean, I'm not against having file:line, and @ntrel suggested having it as a tooltip IIRC, I'm just looking at ways to shorten the selection box since your image in the OP is indeed hard to use. |
I just noticed this problem and I personally also find it a little too verbose and harder to use than the previous simple |
Sorry for the long delay. I submitted Colomban's code as a pull request. |
I meant to post the above to #3542 so I reposted it there too. |
When there is more than one matching symbol. For variables, show type. For callables, show (at least) parameter list. Show non-first item using italic `file:line:`.
(Shown when there is more than one matching symbol).
For variables, show type.
For callables, show signature.
Show non-first item using italic
file:line:
.