Xcode using FIXME, TODO, ???,?

2019-03-08 05:24发布

I have started to use the FIXME, TODO, ??? and !!! tags in XCode but have am finding it painful that it does not recognise the tags when they are within a function. The tags are only recognised outside a given function.

How can I get these tags recognised within a function (as this is where the bugs are)?

8条回答
Evening l夕情丶
2楼-- · 2019-03-08 05:44

Just a heads up, but I've noticed the TODO:'s do not work within blocks of any kind. Just move it right above or below your block.

查看更多
疯言疯语
3楼-- · 2019-03-08 05:54

In xcode 4.1 (don't know if this works in previous versions) I write

#warning TODO: fix this later...

to get a compile warning or

#error FIXME: fix now!

to get a compile error.

I also add these to the code snippet library to make it really ease to add todos.

查看更多
男人必须洒脱
4楼-- · 2019-03-08 05:54

A workaround is to use a build script which marks those as warnings:

KEYWORDS="TODO|FIXME|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | \
xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | \
perl -p -e "s/($KEYWORDS)/ warning: \$1/"

Credit to Benjamin Ragheb.

查看更多
甜甜的少女心
5楼-- · 2019-03-08 06:00

The FIXME:, TODO:, ???: and !!!: works in 4.3.3 inside and outside of functions.

You can have any number of whitespace before or after the double slash, but you have to use uppercase and follow the tag with a colon.

Just to make it clear - all of these work:

//          FIXME: This works.
  //TODO: This works.
    //                  !!!: Working.
// // //???: Works as well.
查看更多
男人必须洒脱
6楼-- · 2019-03-08 06:05

xCode 6 beta 4 should support MARK, TODO and FIXME landmarks.

Xcode now supports //MARK:, //TODO: and //FIXME landmarks to annotate your code and lists them in the jump bar. (14768427)!

查看更多
7楼-- · 2019-03-08 06:08

how about this Xcode plugin? --> https://github.com/trawor/XToDo

查看更多
登录 后发表回答