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

已回答

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?

0

Please register your documentation provider with

order="before html"

in plugin.xml

0
Avatar
Permanently deleted user

@Yann Cebron

Seems still not working, in HTML files and Vue files

<lang.documentationProvider language="XML" implementationClass="lineMarker.ComponentDocumentationProvider" order="before html"/>
0
Avatar
Permanently deleted user
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

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

 

0
Avatar
Permanently deleted user

@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

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

1
Avatar
Permanently deleted user

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

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

0
Avatar
Permanently deleted user

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

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
Avatar
Permanently deleted user
0

请先登录再写评论。