drmariod
drmariod

Reputation: 11762

TODO comments in rStudio

is there a way to list ToDo comments in rstudio?
Before I used eclipse and really loved to put some # TODO I definitely need more unit tests here! comments in my source code.

I could not find this feature in rStudio so far and I was wondering, if there is something like a plugin or maybe an easy way of searching such comments.

Upvotes: 37

Views: 14252

Answers (4)

Fabian
Fabian

Reputation: 111

You can use the outline list by having:

# TODO I definitely need more unit tests here! ####

Just keep in mind that you have to have 4 '#' at the end of the line

Upvotes: 11

andschar
andschar

Reputation: 3973

If you work with git and the files are tracked you can use

git grep TODO

in the terminal (which is also included in the Rstudio IDE) to get a list of your TODOs.

Upvotes: 5

Konrad
Konrad

Reputation: 18585

I would suggest that you consider the todor RStudio add-in by dokato. After installing via devtools:

devtools::install_github("dokato/todor")

You will be able to conveniently list ToDo items across your project:

sourcing

Official example

(images and code sourced from: https://github.com/dokato/todor)

Upvotes: 21

Jonathan
Jonathan

Reputation: 8812

There is no such system in RStudio, but there is an easy way of searching for the comments. Do this:

  1. Go to Edit -> Find in Files
  2. Tick the checkbox "Regular Expression"
  3. Enter the following regular expression: ^\s*# TODO
  4. Click Find

That regular expression will match any line that starts with # TODO.

Upvotes: 20

Related Questions