How do I specify which element is linked to in the documentation

Answered

You know, in Javadoc,  you can link to another method. In a plugin of a custom language, how do I specify the documentation of which element to pull out when clicking on the linik?

0
1 comment

Hi Vincent,

You should use HTML links with a special protocol. Example:

<a href='psi_element://your element identifier/path/something else that allows to identity it'>Text</a>

Protocol constant: com.intellij.codeInsight.documentation.DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL

You also need to implement com.intellij.lang.documentation.DocumentationProvider#getDocumentationElementForLink, which will return a target element for a given link.

1

Please sign in to leave a comment.