Radu Dumbrăveanu
Radu Dumbrăveanu

Reputation: 1416

Escaping someway the Todo keyword in IntelliJ IDEA

I'm developing an example of web application (in Java) which is used to manage Todo tasks. Thus I have an entity called Todo and obviously in many comments I use the Todo word referring to my Todo entity (not to a TODO item regarding the code), e.g.

/**
 * Todo entity model.
 */
@Entity
public class Todo {

in result I'm getting this warning from IntelliJ IDEA

Warning:(*, 2) Complete the task associated to this TODO comment.

I've tried to use {@code Todo} and {@literal Todo}, but the warning does not disappear. How can I escape the Todo keyword in order to get rid of warnings from IDEA?

Upvotes: 4

Views: 840

Answers (2)

haggisandchips
haggisandchips

Reputation: 542

You could change the todo setting for IDEA ...

File -> Settings -> Editor -> TODO - adjust the \btodo\b.* entry: either remove it or perhaps change to uppercase and enable the case-sensitive option.

Upvotes: 4

Esteban
Esteban

Reputation: 74

My suggestion is to change the regex use to match TODOs in Intellij, to prevent matching those cases where the Todo is between curly braces. Considering the example below:

/**
 * {@code org.reminder.Todo}
 * Todo this is the only matching TODO task
 * NotaTODO in this line
 *
 */

The following regex for TODOs (in menu File -> Settings -> Editor -> TODO), will match the desired TODOs in any case:

\btodo(\b[^}]).*

Further description about the regex for Intellij IDEA is available at Intellij IDEA- Regular Expression Syntax Reference.

Upvotes: 1

Related Questions