IQuickDocProvider interface provides two methods:
CanNavigate is called to see if the provider can generate documentation based on the given
IDataContext. If it returns true, no other providers are checked. If it returns false, the
QuickDocManager continues to other providers.
The provider queries the passed in
IDataContext to find data that it needs to provide documentation. This might be using
DataConstants.DOCUMENT_OFFSET to get the current document and offset, in order to get the PSI tree node at the text caret location, or it might be using
DataConstants.DECLARED_ELEMENTS to get the
IDeclaredElement at the text caret. The requirements here depend on what the provider wants to document. (See
IDataContext for more details.)
Resolve is called by the
QuickDocManager when initially displaying the documentation (the name makes more sense when dealing with navigation from one presenter to another). The
IDataContext is passed in, from which the provider should extract whatever data is required in order to be able to display documentation, and this data is used to create an instance of
IQuickDocPresenter. The provider then retrieves the
PsiLanguageType of the item being documented, and calls the passed in
resolved action. (This action, provided by
ShowQuickDocAction, is responsible for creating and managing the popup window and the web browser used to host the HTML).
You need to decorate your
IQuickDocProvider class with
QuickDocProviderAttribute, and pass a priority into the constructor. The list of providers maintained by
QuickDocManager is an ordered list, with the lowest priority being at the start of the list (any new items being added to the
IViewable<IQuickDocProvider> are inserted in the correct position in the list). The majority of the default providers have a priority of
0. You only need to provide a higher or lower priority if the items you're intending to document are also handled by the default providers, and you wish to override or provide a fallback.