Please read and review: Draft of article "Developing custom language plugins for IDEA"
Hello everyone,
A very commonly requested documentation item was an article explaining the
concepts and usage of the IDEA Language API. Well, now there is one - or
at least, a draft for one. Before the article is published officially, I'd
like to give you the chance to review and comment on it.
What I'm most interested in is:
- if you have already used the Language API - are there any difficulties
or pitfalls that you encountered and that are not described in the article?
- if you have not used the Language API - does the article give you a clear
idea of how to use it, or are there any concepts that should be explained
in more detail?
The current draft of the article is posted at:
http://www.yole.ru/CustomLanguagePlugins.html
Thanks in advance for your help!
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Please sign in to leave a comment.
How is the source file and its corresponding AST kept in sync?
For example, if I type a space in the middle of a source file, would it not be necessary to change all the text ranges in the ASTs following that text?
If I rename a method, is the entire source file re-written?
Just explaning the above scenarios would make things clear.
There are hints in the document with regard to this sync, but more explanation would be great.
Farokh Morshed wrote:
I believe text ranges are not recomputed, but rather the entire file is
reparsed, and old ASTNodes and PsiElements are marked invalid.
I believe all changes cause a full reparse. (Lexing is another issue.)
Hello Keith,
>> How is the source file and its corresponding AST kept in sync?
>>
>> For example, if I type a space in the middle of a source file, would
>> it not be necessary to change all the text ranges in the ASTs
>> following that text?
>>
Not the entire file is reparsed, but a certain region of it, e.g. when IDEA
detects the changes are isolated in the code block, then only that block
is reparsed.
>> If I rename a method, is the entire source file re-written?
>>
No, you are wrong. Changes via PSI write interface do not cause reparse,
but are done on the parsed tree and synchronized back to document. Otherwise
no refactoring could work:)
Eugene.
Eugene Vigdorchik (JetBrains) wrote:
>> Farokh Morshed wrote:
>>
>>> How is the source file and its corresponding AST kept in sync?
>>>
>>> For example, if I type a space in the middle of a source file, would
>>> it not be necessary to change all the text ranges in the ASTs
>>> following that text?
>>>
>> I believe text ranges are not recomputed, but rather the entire file
>> is reparsed, and old ASTNodes and PsiElements are marked invalid.
How does this happen? I've noticed that even after any change, my parser
is called from the beginning (there's not even a mechanism to parse
incrementally).
>>
>>> If I rename a method, is the entire source file re-written?
>>>
>> I believe all changes cause a full reparse. (Lexing is another issue.)
I thought Farokh meant changes to text.
The element type that should be incrementally reparsable should implement IChameleonElementType. Using this class should be documented however.
Hi Dmitry,
I was excited to find PythonID this morning. I put the JAR in my /plugins directory and fired up Selena 7343. Unfortunately, it tells me that PythonID is incompatible. Any plans to update it? I'm using Komodo for my first Python IDE, but of course I'd prefer IntelliJ if it were available to me.
Brilliant product, by the way. Please do keep it up - you're way ahead of the Eclipses and NetBeans of the world in my eyes. Sincerely, Michael
Hello Michael,
In fact the CVS version of Pythonid (which is available on pythonid.dev.java.net)
has already been updated for Selena compatibility. I'll put up a release
on plugins.intellij.net soon.
Thanks for the feedback. :)
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
I was able to follow the directions above to check out and build the pythonid plugin for Idea 7. It works for me. Thanks!
Brilliant - I'll check it out. Thanks again. - %