Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

show documentation in code completion #513

Closed
liamdawson opened this issue Oct 7, 2017 · 2 comments
Closed

show documentation in code completion #513

liamdawson opened this issue Oct 7, 2017 · 2 comments

Comments

@liamdawson
Copy link

liamdawson commented Oct 7, 2017

When Intellisense in VS Code suggests a method, it does not display the documentation for the method:

image

I would have expected it to show (at minimum):

Constructs a new Arc.

https://doc.rust-lang.org/std/sync/struct.Arc.html#method.new

I would love to contribute this feature, if someone can point me in the right direction.

@est31
Copy link
Member

est31 commented Oct 7, 2017

Its planned afaik, cc @steveklabnik

@Xanewok
Copy link
Member

Xanewok commented Oct 7, 2017

In general, an ad hoc way to implement this right now would probably be to, after retrieving completion data from Racer, map the CompletionItems and attach a documentation?: string to each CompletionItem.

There's a minor detail - you only have a hypothetical text completion and not an actual Span in the file/buffer (before applying the completion) that are pre-analyzed, and so for each completion you'd have to (I think) try to search_for_id and somehow guess (using some path heuristic?) a correct symbol Id (if there are multiple valid ones for each symbol name) and call docs for it.
This would be much simpler if you had a Span already, using id and maybe it's possible currently and I'm not seeing something.

Using this approach, this may or may not be noticeably more costly to fetch and prepare diagnostics, so it's also something to have in mind. However I do agree that'd be very, very handy to have!

@nrc nrc changed the title Method suggestion does not show documentation show documentation in code completion Oct 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants