How to make idea aware of TODOs within custom language
The todo’s within comments for my custom language do not seem to be taken in consideration by the IDE. Is there something I have to implement in addition to ParserDefinition.getCommentTokens()?
请先登录再写评论。
The api documentation states "The To Do view is supported automatically if the plugin provides a correct implementation of the ParserDefinition.getCommentTokens() method.".
As far as my language parser is concerned, it implements this method. Looking at the parsed file with PsiViewer, it even shows the comments as PsiComment elements. So this may be a bug within the IDE. Or can it be that I need to somehow register my language for the TODO management?
Have identified the issue myself. I am using a two lexer strategy for highlighting and for parsing, each one working on different sets of token types.
The ParserDefinition.getCommentTokens() seems to be needing the highlighter tokens and not the parser tokens as I was expecting.
The solution is to use shared token types (among the parser and highlighter lexer) wherever possible.
Another usage of ParserDefinition.getCommentTokens() is that the PsiBuilder will skip those tokens automatically.