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 :))

0
8 comments

The document in Confluence is actually fairly up-to-date. Which deprecated classes are mentioned there? Which additional information do you need?

0
Avatar
Permanently deleted user

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

0

OK, I'll spend some time in the coming days updating the Confluence document and adding links to example code.

0
Avatar
Permanently deleted user

Thank you very Very VERY MUCH! :)

0
Avatar
Permanently deleted user

Super! You are the best! :)

0
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

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

thank you :)

0

Please sign in to leave a comment.