-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Option to abbreviate completion info with completeopt+=popup #3547
Comments
don't you think the extraordinarily long signatures would be a problem for the popup too ? I think the issue here is that the signature info is long, not specifically anything to do with popups. Even without You didn't include any steps to reproduce, so it's unclear if this is a bug or not, nor which completer server we would change if it were. |
It's not a bug—this is a feature request/RFC—but for what it's worth the screenshot is from the typescript completer ( As you say, the signature itself is wider than the screen, but if the signature is removed from the pum then it can be viewed in the popup, which also includes documentation. The signature may wrap, but I don't think that's worse than it getting cutoff in the pum, and having documentation might actually be a beter UX. Normally I have |
The problem in implementing this is that there's no way to know of the 'preview' contents (which might be displayed in a popup) actually even contains the data that would be in the 'extra' menu info. That's true of course for an arbitrary language/server, but it's even true for a given (specific) language/server. I kind of take the point that this display isn't optimal, but I don't know that there's a simple, canonical, maintainable way we could improve it. I also don't think this problem is likely to be unique to YCM. Perhaps you're right that the 'preview' popup should have a minimum width (and probably fall back to the preview window in that case). You could try vim-dev for that. |
I'm going to leave this open, because we may be able to improve this, but it's probably going to remain in the ideas or PRs welcome category until we can think up a good solution. |
Aren't the EDIT: A "real" solution would probably be more complicated than this, of course, but wanted to try it and throw it out there as a POC. A real solution would probably might want the option to do this on a per-filetype basis, only if |
Even your POC just shows how much information is lost by removing the |
I see your point, but I suppose it depends on your perspective. For me, having the long signature on every method starts to become noisy. With this it's more focused, showing me the detailed information only on the thing I'm actively looking at. I can imagine that some people would like the signature on every method though; that's why I suggested it being an option. I also understand, though, that every option introduced means more complexity to maintain, and I can definitely appreciate that. EDIT: I got most of the way through writing up a post to vim-dev, but it sounds like the upcoming
|
I would love an option to hide the signature in the completion menu, allowing us to rely on the popup to display the signature instead. It reduces the signal to noise ratio of the completion list IMHO. I think this is how vscode intellisense works (not that it's necessarily the golden standard or anything, but still): |
I mean I guess we could suppress it if Options are bad, so we need to come up with a heuristic that automatically makes it work without switches or dials. |
Yeah, I think it boils down to whether or not the current language/project has "verbose" signatures. For this reason I can't think of a solution that doesn't involve adding an option. An option would be changeable by the user globally, and via FileType autocommands if the user had a preference for a particular language/project.
When would the heuristic run? Before showing the first completion menu within each file? On every keypress? Having YCM switch between including/excluding the entire signature on a case by case basis sounds like it would be confusing/annoying UX 😟 If an heuristic was implemented and it wasn't perfect I'm guessing it wouldn't be long until someone requested the ability to configure it. |
You make good points. I think actually if you think about it, there's already an option:
|
Really appreciating the quick responses! Using Are you implying that no change could/will be made to the current behaviour, or that this could be implemented?
I hope I'm not coming off as demanding. |
Does anyone have a minimal reproduction case ? I don't see one on any of the related issues. |
TBH with typescript, I think the issues is just that the signature is in both the extra menu info and the preview window. I'm not sure why we have that exactly |
Please try out the PR in #3567 and provide feedback |
It's the same in python, java and clangd. |
It's a big improvement! As both you and @bstaletic wrote it will result in signature duplication in multiple languages though. I still think there's a case for the allowing the signature to be hidden in the completion menu. See the screenshots below for a comparison. |
didn't we just recently add the signature to the extra menu info for typescript? Maybe there's just a better thing we could put there, like the return value or something ? Having that extra info there allows you to see it for all visible items, rather than just the "selected" one. Remember that YCM's whole thing is that you just keep typing rather than scrolling through the menu, which is why we try to make things visible rather than hidden. |
The popup/preview window has the advantage of allowing multilines signatures which can improve readability for longer ones such as the one you posted. I just tried Python and it doesn't appear to be consistent regarding signatures in the docs, doh. Since the signature sometimes differ in style between completion and docs it seems non-trivial to determine whether to prepend it to the popup or not. Sorry for bringing more questions rather than solutions, maybe someone else has some input or ideas? |
I guess Jedi is using the type annotations/hints. Maybe they aren't there for they are for mine: For me, the truncation approach seems to work reasonably well: Edit: Actually, in your case the preview popup is probably just scrolled. I can't see the scrollbar in your colour scheme. |
For the record I almost never use typescript, so I'm completely ambivalent about whether or not we keep the signature in the popup for that language. Personally it seems like the signature we're creating contains too much non-data-ink and doesn't really add much value, so I would be OK to remove it, but I do feel that's a breaking change, and that it might be better to parse the 'displayParts' more intelligently to see if we can construct something shorter that contains useful info (such as just the names, not types of arguments maybe) |
Yeah, looks like we've got different docs.
That could definitely have been the issue, but after colorizing the scrollbar nothing appeared to be missing (got no scrollbar in the popup), so I think it's just a case of mismatched docs.
The issue mostly pertains to languages with verbose typing, TypeScript being the latest addition. There's an issue in the TypeScript repo regarding this (Shorten method signatures) posted in 2017 that's still open. I imagine that it would be somewhat complicated to write a TypeScript signature shortener that handles all possible edge cases (nested objects/generics etc.), but I could take a stab at some Regex hacking if you think it would be reasonable. |
This issue has been open and my WIP branch available for quite some time now. Nobody has offered a PR to complete that work, or offered better suggested heuristics. I gather from that that there is not much interest In the change ? I'll leave this 1 more week then close it. |
I'm definitely still interested! I just checked out your fork and it feels pretty great so far. I like that I don't have any preview windows moving around, and it's quite usable. I think in the future the potential to expand the One issue I ran into (also evidenced in the above image) is that, in typescript, the |
How interested? Like make a PR with tests and documentation interested? |
Fixes ycm-core#3547 Based entirely on: puremourning@0dd1b7d
Added a small handful of tests and fixed the behavior I was seeing with the duplicated signatures from Typescript, and documented the new option—see PR linked above! |
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
insidethe brackets) before filing your issue:
[Frequently Asked Questions][faq] section.
about to report and couldn't find an answer to my problem. ([Example Google
search.][search])
vim --version
.:YcmDebugInfo
.the
:YcmToggleLogs
command.version) I am using.
my issue, including what I expected to happen and what actually happened.
of
install.py
(orcmake
/make
/ninja
) including its invocationthat any help I receive is a selfless, heartfelt gift of their free time. I
know I am not entitled to anything and will be polite and courteous.
actually perform all of these steps.
Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
Issue Details
In general, the completion detail that YCM provides is great and I've been enjoying it for years. However, with the new
completepopup
option (set completeopt+=popup
) it can be too long:As an option, or perhaps automatically if
popup
is set (or maybe an option that takes effect ifpopup
is set?) it'd be nice to omit the extra info to the right of the completion type, since the popup makes it redundant anyway, and because it means the popup is too squished to be legible.Alternatively, you may prefer that this be fixed upstream in vim by having a
min-width
config (or something) in thecompletepopup
option?Thanks for your time!
The text was updated successfully, but these errors were encountered: