rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

feat: add hover display for trait assoc items

Open Young-Flash opened this issue 2 years ago • 15 comments

This PR enable preview assoc items when hover on trait

image

inspired by https://github.com/rust-lang/rust-analyzer/pull/15847

Young-Flash avatar Nov 20 '23 10:11 Young-Flash

How does this look when hovering Iterator?

flodiebold avatar Nov 20 '23 14:11 flodiebold

image

image

lnicola avatar Nov 20 '23 14:11 lnicola

Looks like we don't display Where T: Tr, properly, and we should probably respect #[unstable] and #[doc(hidden)].

lnicola avatar Nov 20 '23 14:11 lnicola

IMO hiding the documentation below this is not worth it, at least not by default. Or we should at least limit it (like rustdoc collapses the long list of methods).

flodiebold avatar Nov 20 '23 14:11 flodiebold

Agreed, if we do this we should at least have a config for limiting the number of items / disabling it fully, similarly how we should still do such a config for struct fields hover -> https://github.com/rust-lang/rust-analyzer/pull/15847#issuecomment-1805777597

Veykril avatar Nov 20 '23 14:11 Veykril

How does this look when hovering Iterator?

kind of ugly haha

I may not want to browse the detail of it within a hover len

Young-Flash avatar Nov 20 '23 15:11 Young-Flash

:umbrella: The latest upstream changes (presumably #16279) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jan 06 '24 18:01 bors

@Young-Flash what is the status on this PR?

Veykril avatar Feb 12 '24 12:02 Veykril

will continue working on this after my vacation

Young-Flash avatar Feb 13 '24 10:02 Young-Flash

:umbrella: The latest upstream changes (presumably #16606) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Feb 20 '24 14:02 bors

add "rust-analyzer.traitItemDisplayNum" (default 7) config item, now it looks like the following

image

Young-Flash avatar Feb 26 '24 02:02 Young-Flash

will do the same for hover struct and enum if it's ok with you

Young-Flash avatar Feb 27 '24 09:02 Young-Flash

Yes let's have a config for those as well

Veykril avatar Feb 27 '24 11:02 Veykril

Yes let's have a config for those as well

will make it at next PR

Young-Flash avatar Feb 27 '24 13:02 Young-Flash

how about merge this for now (anything else I can do here?)

Young-Flash avatar Feb 29 '24 01:02 Young-Flash

@rustbot ready

Young-Flash avatar Mar 04 '24 08:03 Young-Flash

Thanks! (will do a minor adjustment as a follow up) @bors r+

Veykril avatar Mar 05 '24 08:03 Veykril

:pushpin: Commit dba67b46a118b6a0e58c6aa87c63f7d96a837888 has been approved by Veykril

It is now in the queue for this repository.

bors avatar Mar 05 '24 08:03 bors

:hourglass: Testing commit dba67b46a118b6a0e58c6aa87c63f7d96a837888 with merge ce3216e0ae56c72656a94864277b311627e980df...

bors avatar Mar 05 '24 08:03 bors

:sunny: Test successful - checks-actions Approved by: Veykril Pushing ce3216e0ae56c72656a94864277b311627e980df to master...

bors avatar Mar 05 '24 08:03 bors