JS Plugin As Example

I am trying to use the JS example plugin as an example for a different, but java-like language. I am having trouble finding out what I need to implement to at least get started and see something working - ie. the bare minimum so I can see my new file type, etc.
Anyway, one specific question I have at the moment is in the JS plugin, the JSFile extends PSFileBase and implements PsiElement(JSElement) - but it seems to be broken both in the implementation and in the fact that the method that uses it, createFile from ParserDefinition, requires PsiFile, not PsiFileBase. PsiFile requires dozens of methods to be implemented, and so far, I can't see what is absolutely necessary. Has the API changed, or am I not understanding something?

I appreciate any help!

adam

12 comments
Comment actions Permalink

Hi,

PsiFileBase implements PsiFile within hierarchy

Adam wrote:

I am trying to use the JS example plugin as an example for a different, but java-like language. I am having trouble finding out what I need to implement to at least get started and see something working - ie. the bare minimum so I can see my new file type, etc.
Anyway, one specific question I have at the moment is in the JS plugin, the JSFile extends PSFileBase and implements PsiElement(JSElement) - but it seems to be broken both in the implementation and in the fact that the method that uses it, createFile from ParserDefinition, requires PsiFile, not PsiFileBase. PsiFile requires dozens of methods to be implemented, and so far, I can't see what is absolutely necessary. Has the API changed, or am I not understanding something?

I appreciate any help!

adam



--
Maxim Mossienko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Could it be that there is a version mismatch? IntelliJ is showing red all over JSFile and also its caller because of un-implemented methods and PsiFileBase being used where PsiFile is expected.

adam

0
Comment actions Permalink

Adam wrote:

Could it be that there is a version mismatch? IntelliJ is showing red all over JSFile and also its caller because of un-implemented methods and PsiFileBase being used where PsiFile is expected.

adam


I've been toying around with the language API and noticed that you need idea.jar
in your classpath (The devkit does normally not include it because it /should/ only
contain internal implementation classes). But I'm not sure if the problem was with
the PsiFile implementation or something else.

Sascha

0
Comment actions Permalink

This should not be the case since com.intellij.extapi.psi.PsiFileBase.class
can indeed be found in 3245's openapi.jar
-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Adam wrote:

>> Could it be that there is a version mismatch? IntelliJ is showing
>> red all over JSFile and also its caller because of un-implemented
>> methods and PsiFileBase being used where PsiFile is expected.
>>
>> adam
>>

I've been toying around with the language API and noticed that you
need idea.jar
in your classpath (The devkit does normally not include it because it
/should/ only
contain internal implementation classes). But I'm not sure if the
problem was with
the PsiFile implementation or something else.
Sascha




0
Comment actions Permalink

Maxim Shafirov wrote:

This should not be the case since
com.intellij.extapi.psi.PsiFileBase.class can indeed be found in 3245's
openapi.jar


I really don't remember any more, but I was having similar problems and
know I added idea.jar in the process of solving the problem. If you're
interested I can try to find out what the exact problem was and how I
solved it. Maybe it was something totally different :-/

Sascha

0
Comment actions Permalink

Thanks Sascha, that would be great.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

Maxim Shafirov wrote:

>> This should not be the case since
>> com.intellij.extapi.psi.PsiFileBase.class can indeed be found in
>> 3245's openapi.jar
>>

I really don't remember any more, but I was having similar problems
and know I added idea.jar in the process of solving the problem. If
you're interested I can try to find out what the exact problem was and
how I solved it. Maybe it was something totally different :-/

Sascha




0
Comment actions Permalink

This is easy to test. I see it just when loading thejs plugin source into a clean intellij sdk.

0
Comment actions Permalink

idea.jar is required because you need all supers of the abstract PsiFileBase in order to be able to compile its subs.

0
Comment actions Permalink

Thanks Maas.

I knew that wouldn't work for some reason. As the matter of fact we need
plugin developers to inherit from PsiFileBase but wouldn't like to make it
real OpenApi since it depends on things we definetely do not open :).

I think we have to come up with another solution.

-


Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"

idea.jar is required because you need all supers of the abstract
PsiFileBase in order to be able to compile its subs.




0
Comment actions Permalink

Maas van den Berg wrote:

idea.jar is required because you need all supers of the abstract PsiFileBase in order to be able to compile its subs.


Yeah, that's it. The classes "com.intellij.psi.impl.ElementBase" and "com.intellij.psi.impl.source.PsiFileImpl"
(and maybe some of their dependencies as well) are required to edit & compile a custom language plugin.

Sascha

0
Comment actions Permalink

thanks everybody - this was really slowing me down. And I did not want to implement PsiFile;)

0
Comment actions Permalink

Happy refactoring. Fortunately you'll be using 'The Best Tool'. :)

0

Please sign in to leave a comment.