Parsing in the editor
Hi,
I was just taking a look at the api for extending IntelliJ.
I see that the parser needs to be implemented manually and cannot be auto generated from tools like ANTLR.
One thing which is not too clear to me is this-
Is the entire file parsed completly after a certain time interval or does the ide do incremental parsing?
The documentation says nothing about how often the file is parsed or whether it is parsed incrementally or not?
This is a pretty major point cause if the entire file is reparsed then we have to subsequentally update all the data structures too which can have quite an impact on the speed of our plugin.
Please sign in to leave a comment.
Hello Prashant,
P> I was just taking a look at the api for extending IntelliJ.
P> I see that the parser needs to be implemented manually and cannot be
P> auto generated from tools like ANTLR.
P>
P> One thing which is not too clear to me is this-
P>
P> Is the entire file parsed completly after a certain time interval or
P> does the ide do incremental parsing?
P>
P> The documentation says nothing about how often the file is parsed or
P> whether it is parsed incrementally or not?
P>
P> This is a pretty major point cause if the entire file is reparsed
P> then we have to subsequentally update all the data structures too
P> which can have quite an impact on the speed of our plugin.
In fact, this is documented in the javadocs for the PsiParser interface.
The default behavior is complete reparse, but you can support incremental
parsing using chameleon tokens. A chameleon token is an entity which is returned
as a single token during the initial parse (for example, an entire method
in a Java file can be a single token), and is parsed completely when its
contents becomes important for the language plugin.
--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Prashant: i've got an adaptor lib so you can use antlr nowadays. https://github.com/antlr/jetbrains there is also a sample plugin: https://github.com/antlr/jetbrains-plugin-sample