简体   繁体   中英

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), eg

/**
 * 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?

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM