detect errors programmatically

I am developing a plugin for intellij.  I want to know if there is a possibility to create a boolean that is true if there are no errors in the code and false if the code contains one ore more errors. The editor underlines every error. Who gives the editor this information and where can I access them?

1 comment
Avatar
Patrick Scheibe
Comment actions Permalink

The parser you should have written for you language makes the basic error annotations. You don't have to set a boolean. When the parser works through the stream of tokens, you have to set so-called marks which build up a parse-tree for the code. If something in the code is wrong, you just close the corresponding mark with an error by calling mark.error(String message). I'm not sure whether this really helps you, because the whole API is overwhelmingly large, but for a first start you can read this tutorial here

http://confluence.jetbrains.com/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEA

or, if you want to see a small working example, go through this here (but they use a parser generator)

http://confluence.jetbrains.com/display/IntelliJIDEA/Custom+Language+Support

0

Please sign in to leave a comment.