Dev custom language plugin
Hello!
I am working with the corporate language (based on Pascal) and I want to make plugin for Idea.
I read this: http://confluence.jetbrains.net/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEA
And this: http://www.jetbrains.com/idea/documentation/idea_5.0.html
http://confluence.jetbrains.net/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEAbut there is too little information, or it is outdated and most of the classes and methods are deprecated...
Can you take me some example?
P.S. Itellij 11.0
P.S.S Sorry for my english :))
Please sign in to leave a comment.
The document in Confluence is actually fairly up-to-date. Which deprecated classes are mentioned there? Which additional information do you need?
Hi
I meant that this document (http://www.jetbrains.com/idea/documentation/idea_5.0.html) is out of date now.
And this document(http://confluence.jetbrains.net/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEA) has no any examples, so I'm pretty hard to understand tutorial
OK, I'll spend some time in the coming days updating the Confluence document and adding links to example code.
Thank you very Very VERY MUCH! :)
Super! You are the best! :)
Alex, you can also see some examples of custom languages support. E.g. my nginx plugin that supports configuration files syntax http://plugins.intellij.net/plugin/?id=4415 , https://github.com/ishchenko/idea-nginx
Hi!
Thanks all for help.
Another one problem:
Resolve method is not called in my PsiReference.
In plugin.xml:
<psi.referenceContributor language="BSS" implementation="net.silnote.bss.references.BSSReferenceContributor"/>
In BSSReferenceContributor:
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(BSSIdentifireImpl.class),
new BSSReferenceProvider());
}
This method called. Size of result > 0
In BSSReferenceProvider:
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
List<PsiReference> result = new ArrayList<PsiReference>() {};
List<PsiElement> idents = BSSUtil.findUniqueElementsByType(((BSSIdentifireImpl) psiElement).getContainingFile(), BSSIdentifireImpl.class);
String name = ((BSSIdentifireImpl) psiElement).getName();
if(idents != null) {
for(PsiElement ident : idents) {
...
result.add(new BSSReference(ident, ident.getTextRange()));
...
}
}
System.out.println("Size of result " + result.size());
return result.toArray(new PsiReference[result.size()]);
}
This method called. Size of result > 0
In BSSReference:
public ResolveResult[] multiResolve(boolean incompleteCode) {
System.out.println("BSSIdent multiResolve");
...
}
@Nullable
@Override
public PsiElement resolve() {
System.out.println("resolve");
...
}
@Override
public boolean isReferenceTo(PsiElement element) {
System.out.println("isReferenceTo");
...
}
No one method called.
In BSSIdentifireImpl:
@NotNull
@Override
public PsiReference[] getReferences() {
System.out.println("getReferences size of " + ReferenceProvidersRegistry.getReferencesFromProviders(this).length);
return ReferenceProvidersRegistry.getReferencesFromProviders(this);
}
Method called. Size of result > 0.
@Override
public PsiReference getReference() {
PsiReference[] refs = getReferences();
System.out.println(refs);
return refs.length > 0 ? refs[0] : null;
}
Method not called
What is wrong?
Attachment(s):
BSSIdentifireImpl.java.zip
BSSReference.java.zip
BSSReferenceProvider.java.zip
BSSReferenceContributor.java.zip
thank you :)