Do I need to do anything special to have multi-line TODO comments work for line comments in my custom language?
I just updated to IntelliJ IDEA 2018.3 and one of the features I'm most excited about is multi-line TODO comments. My code generally contains a host of blocks like the following:
// TODO: Do something ... too long for this line
// TODO: and continue on the next line...
// TODO: and maybe even more...
in order to get the correct highlighting, and of course this new feature would clean those up quite a bit (and definitely help when updating/reformatting these comments!).
This seems to be working fine for Java, JavaScript, etc., and I assumed it would also work fine for the custom language I've implemented for my plugin, but it doesn't seem to be working properly. In particular, indented continuation lines aren't highlighted properly, e.g.:
// TODO: This line is highlighted
// but this line isn't
Note, though, that if I press Enter just before the word "highlighted", it does properly handle the continuation, albeit still without proper highlighting, e.g.:
// TODO: This line is
// highlighted
// but this line isn't
I looked to see if there might be some special interface I needed to implement now in my plugin, but I'm not seeing anything. I started to debug it a bit inside of com.intellij.psi.impl.search.IndexPatternSearcher#collectPatternMatches which is where it seems to be deciding whether or not comment ranges continue one another, and it does seem to be deciding that the second range doesn't continue the first range. I haven't debugged much further than that it seems to be happening in that area, though, as I'm just about to check out mentally for the holiday weekend. Before doing so, though, I figured I'd post this real quick to see if anyone else might know better what's going on and what I might need to do to fix it.
Thanks much!
Please sign in to leave a comment.
Note that the same behavior occurs with block/doc comments in my custom language but works properly in Java/JavaScript, e.g.,:
So it definitely seems to be something specific to my custom language and how its comments are being handled.
I just tried the same thing in another custom language--Grammar-Kit BNF--and it fails in the exact same manner as in my custom language. It looks more and more like this might be an issue with the new feature (or at least something that needs to be added to existing custom languages to enable it). I'll file a bug.
I just logged the following bug for this:
https://youtrack.jetbrains.com/issue/IJSDK-506
Answered in the ticket.
Thanks much, Dmitry!
Seems like this is now available in RIDER EAP and probably in intellij
https://www.jetbrains.com/rider/nextversion/