I cannot get plain text TODO items in my plugin to show up in the todo window
I cannot get plain text TODO items in my plugin to show up in the todo window. The count of todo items n the file is correct but no elements show up.
What else is potentially affecting whether the todo found by the FilterIndexerwill show up in the todo window? Or what else do I need to implement to allow plain text to do elements to show up.
I even tried changing the code to return all text as string literals and passingUsageSearchContext.IN_STRINGS, still only the count of items shows up but not the items themselves.
I must be doing something really dumb, missing or including an extra definition somewhere to cause this but I am stuck.
The IElementType for the TODO text matches the one used by the filter lexer as in the debugger
and PsiViewer.

The parser definition has comments only defined. Whitespace is significant so it is left in.
@NotNull public TokenSet getWhitespaceTokens() { // none, we need all of them in the tree return TokenSet.EMPTY; } @NotNull public TokenSet getCommentTokens() { return MdTokenSets.COMMENT_FOR_SYNTAX_SET; } @NotNull public TokenSet getStringLiteralElements() { return TokenSet.EMPTY; //return LexParserState.TEXT_SET; }
The filter lexer:
public class MdFilterLexer extends BaseFilterLexer { public MdFilterLexer(final Lexer originalLexer, final OccurrenceConsumer table) { super(originalLexer, table); } @Override public void advance() { final IElementType tokenType = myDelegate.getTokenType(); if (isTypeOf(tokenType, COMMENT_FOR_TODO_SET)) { scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false); advanceTodoItemCountsInToken(); } else if (isTypeOf(tokenType, LexParserState.TEXT_SET)) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT, false, false); advanceTodoItemCountsInToken(); } myDelegate.advance(); } }
Any pointers where to look would be greatly appreciated.
Please sign in to leave a comment.
I found the bug. It was subtle and caused by a subtle error in my restartable lexer getting out of sync.