How to make the default quick document coexist with my custom document?

Answered

My plugin is for front-end personnel. Modern web frameworks can customize some XML tags. I customized a "Form" tag and provided a quick document, but the IDE is the "form" tag in standard HTML. Information, ignore the quick documentation I added, can this be resolved?

11 comments
Comment actions Permalink

Please register your documentation provider with

order="before html"

in plugin.xml

0
Comment actions Permalink

@Yann Cebron

Seems still not working, in HTML files and Vue files

<lang.documentationProvider language="XML" implementationClass="lineMarker.ComponentDocumentationProvider" order="before html"/>
0
Comment actions Permalink
import com.intellij.lang.documentation.AbstractDocumentationProvider;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.html.HtmlTagImpl;
import org.jetbrains.annotations.Nullable;
import utils.VelocityFactory;
import window.Application;

import java.util.Arrays;

public class ComponentDocumentationProvider extends AbstractDocumentationProvider {

@Override
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
if (element instanceof HtmlTagImpl && Application.componentXmlParse.components != null && Application.componentXmlParse.components.size() > 0) {
HtmlTagImpl htmlTagImplElement = (HtmlTagImpl) element;
for (ComponentXmlParse.Component i : Application.componentXmlParse.components) {
String[] tags = i.getName().split(",");
if (Arrays.asList(tags).contains(htmlTagImplElement.getName())) {
return VelocityFactory.build("ignore/doc/infoPanel.html.vm", i);
}
}
}
return null;
}
}
0
Comment actions Permalink

try order="first" and/or register it for language="HTML" as well

 

0
Comment actions Permalink

@Yann Cebron

None of the following:

<lang.documentationProvider language="HTML" implementationClass="documentation.ComponentDocumentationProvider" order="before html"/>
<lang.documentationProvider language="HTML" implementationClass="documentation.ComponentDocumentationProvider" order="first"/>
<lang.documentationProvider language="XML" implementationClass="documentation.ComponentDocumentationProvider" order="before html"/>
<lang.documentationProvider language="XML" implementationClass="documentation.ComponentDocumentationProvider" order="first"/>
0
Comment actions Permalink

Please remove duplicate registrations for same language. If it still doesn't work, debug com.intellij.lang.documentation.CompositeDocumentationProvider#getQuickNavigateInfo

1
Comment actions Permalink

Of course, I try only one of them at a time, without repeating the registration.
I tried [com.intellij.lang.documentation.CompositeDocumentationProvider], but there are private constructors, I cannot inherit or instantiate them. Honestly, I am a newbie in java, please tell me more information, thank you!

private CompositeDocumentationProvider(List<DocumentationProvider> providers) {
myProviders = providers;
}
0
Comment actions Permalink

I meant to put breakpoint in method of CompositeDocumentionProvider and see which documentation providers are present and actually used

0
Comment actions Permalink

Hello, I put breakpoint debugging at com.intellij.lang.documentation.CompositeDocumentationProvider # getQuickNavigateInfo as you said, and found that my provider is not the first one. According to some clues, I modified my registration information:

<lang.documentationProvider language="HTML" implementationClass="documentation.ComponentDocumentationProvider" id="html" order="first"/>

Now my provider program is ranked first. The content displayed by [control + hover] can overwrite the default text, but for me, scroll bars appear and cannot be copied.
I went on debugging: "com.intellij.lang.documentation.CompositeDocumentationProvider # generateDoc" and found that only my custom tags would enter breakpoints, and standard html tags such as form, input, select, would not enter breakpoint It seems that I directly read a file, which has troubled me for a long time, and I haven't found out the problem. I hope you can help me, thank you!

 

 

 

 

0
Comment actions Permalink

Sorry, but I don't understand your question on how to help you. Could you share your plugin sources and provide some screenshots of the actual problem?

0

Please sign in to leave a comment.