Search in sources :

Example 1 with DocumentationProvider

use of com.intellij.lang.documentation.DocumentationProvider in project intellij-community by JetBrains.

the class MavenDomTestCase method assertDocumentation.

protected void assertDocumentation(String expectedText) throws IOException {
    PsiElement originalElement = getElementAtCaret(myProjectPom);
    PsiElement targetElement = DocumentationManager.getInstance(myProject).findTargetElement(getEditor(), getTestPsiFile(), originalElement);
    DocumentationProvider provider = DocumentationManager.getProviderFromElement(targetElement);
    assertEquals(expectedText, provider.generateDoc(targetElement, originalElement));
    // should work for lookup as well as for tags
    PsiElement lookupElement = provider.getDocumentationElementForLookupItem(PsiManager.getInstance(myProject), originalElement.getText(), originalElement);
    assertSame(targetElement, lookupElement);
}
Also used : PsiElement(com.intellij.psi.PsiElement) DocumentationProvider(com.intellij.lang.documentation.DocumentationProvider)

Example 2 with DocumentationProvider

use of com.intellij.lang.documentation.DocumentationProvider in project intellij-community by JetBrains.

the class HtmlDocumentationProvider method generateDoc.

@Override
public String generateDoc(PsiElement element, PsiElement originalElement) {
    final XmlTag tag = PsiTreeUtil.getParentOfType(originalElement, XmlTag.class, false);
    String result = generateDocForHtml(element, false, tag, originalElement);
    DocumentationProvider styleProvider = getStyleProvider();
    if (result == null && styleProvider != null) {
        result = styleProvider.generateDoc(element, originalElement);
    }
    if (result == null && ourScriptProvider != null) {
        result = ourScriptProvider.generateDoc(element, originalElement);
    }
    if (result == null && element instanceof XmlAttributeValue) {
        result = generateDocForHtml(element.getParent(), false, tag, originalElement);
    }
    return result;
}
Also used : DocumentationProvider(com.intellij.lang.documentation.DocumentationProvider)

Example 3 with DocumentationProvider

use of com.intellij.lang.documentation.DocumentationProvider in project intellij-community by JetBrains.

the class HtmlDocumentationProvider method getDocumentationElementForLink.

@Override
public PsiElement getDocumentationElementForLink(PsiManager psiManager, String link, PsiElement context) {
    PsiElement result = createNavigationElementHTML(psiManager, link, context);
    DocumentationProvider styleProvider = getStyleProvider();
    if (result == null && styleProvider != null) {
        result = styleProvider.getDocumentationElementForLink(psiManager, link, context);
    }
    if (result == null && ourScriptProvider != null && !DumbService.isDumb(psiManager.getProject())) {
        result = ourScriptProvider.getDocumentationElementForLink(psiManager, link, context);
    }
    return result;
}
Also used : PsiElement(com.intellij.psi.PsiElement) DocumentationProvider(com.intellij.lang.documentation.DocumentationProvider)

Example 4 with DocumentationProvider

use of com.intellij.lang.documentation.DocumentationProvider in project intellij-plugins by JetBrains.

the class FlexDocumentationTest method testFlexCssProperty.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testFlexCssProperty() throws Exception {
    DocumentationProvider cssDocumentationProvider = new CssDocumentationProvider();
    PsiElement docElement = getDocElementForLookupItem(cssDocumentationProvider, getTestName(false) + ".css");
    assertInstanceOf(docElement, JSAttributeNameValuePair.class);
}
Also used : PsiElement(com.intellij.psi.PsiElement) CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) FlexDocumentationProvider(com.intellij.javascript.flex.FlexDocumentationProvider) DocumentationProvider(com.intellij.lang.documentation.DocumentationProvider) JSDocumentationProvider(com.intellij.lang.javascript.documentation.JSDocumentationProvider) CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Example 5 with DocumentationProvider

use of com.intellij.lang.documentation.DocumentationProvider in project intellij-plugins by JetBrains.

the class FlexDocumentationTest method testFlexCssPropertyMultiDocumentationInLookup.

@JSTestOptions({ JSTestOption.WithCssSupportLoader, JSTestOption.WithFlexFacet })
public void testFlexCssPropertyMultiDocumentationInLookup() throws Exception {
    DocumentationProvider cssDocProvider = new CssDocumentationProvider();
    String doc = testOne(cssDocProvider, getTestName(false) + ".css", new CssPropertyDescriptorStub("borderColor"));
    assertNotNull(doc);
    assertTrue("Container's borderColor property missing", doc.indexOf("Container") >= 0);
    assertTrue("Button's borderColor property missing", doc.indexOf("Button") >= 0);
    assertTrue("UIComponent's borderColor property missing", doc.indexOf("UIComponent") >= 0);
}
Also used : CssPropertyDescriptorStub(com.intellij.psi.css.descriptor.CssPropertyDescriptorStub) CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) FlexDocumentationProvider(com.intellij.javascript.flex.FlexDocumentationProvider) DocumentationProvider(com.intellij.lang.documentation.DocumentationProvider) JSDocumentationProvider(com.intellij.lang.javascript.documentation.JSDocumentationProvider) CssDocumentationProvider(com.intellij.psi.css.impl.util.CssDocumentationProvider) JSTestOptions(com.intellij.lang.javascript.JSTestOptions)

Aggregations

DocumentationProvider (com.intellij.lang.documentation.DocumentationProvider)25 PsiElement (com.intellij.psi.PsiElement)16 FlexDocumentationProvider (com.intellij.javascript.flex.FlexDocumentationProvider)3 ExternalDocumentationProvider (com.intellij.lang.documentation.ExternalDocumentationProvider)3 JSTestOptions (com.intellij.lang.javascript.JSTestOptions)3 JSDocumentationProvider (com.intellij.lang.javascript.documentation.JSDocumentationProvider)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 PsiFile (com.intellij.psi.PsiFile)3 CssDocumentationProvider (com.intellij.psi.css.impl.util.CssDocumentationProvider)3 LookupElement (com.intellij.codeInsight.lookup.LookupElement)2 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)2 Editor (com.intellij.openapi.editor.Editor)2 DocCommentFixer (com.intellij.codeInsight.documentation.DocCommentFixer)1 LookupEx (com.intellij.codeInsight.lookup.LookupEx)1 CodeDocumentationProvider (com.intellij.lang.documentation.CodeDocumentationProvider)1 CompositeDocumentationProvider (com.intellij.lang.documentation.CompositeDocumentationProvider)1 ExternalDocumentationHandler (com.intellij.lang.documentation.ExternalDocumentationHandler)1 ModuleUtilCore.findModuleForPsiElement (com.intellij.openapi.module.ModuleUtilCore.findModuleForPsiElement)1 Project (com.intellij.openapi.project.Project)1 PopupStep (com.intellij.openapi.ui.popup.PopupStep)1