This time it’s not a single keyboard shortcut. There’s a little known feature of ReSharper, called To-Do Items. It’s a series of tags, you can define, and when you put them in your comments somewhere in the code, ReSharper will pick the comment up and put it, in the To-Do Explorer Window.
There are 3 predefined tags: TODO, BUG, NOTE and NotImplemented which picks up the NotImplementedException occurrences in your code. Yes, this is not a code comment, but most of the time you’ll use comments only.
So how is this useful and boosts productivity?
As you code your way, you can tag it with such comments, mostly for later review or to fix later.
You can then immediately view all of them in To-Do Explorer, and jump to any of them.
One thing I do however, is I redid the tags (defined via regular expressions), because the default ones used to pick up false positives.
I changed the pattern to be case sensitive and to include a colon after a tag. To make use of this feature, I also keep my To-Do Explorer window always visible, to ensure that I do pick up the comments I, or any other developer on the team puts in the code.
I try to be more brutal: throw new NotImplementedException ("Replace this with…")
Or using MbUnit’s [Pending()] attribute on unit tests.
When my team did a lot of "todo"-ing, it turned out to be a bad practice, because it allows you to leave it to be resolved in some distant future… we still have some todos in the comments which are now PITA to get fixed, since we don’t really know what the comment actually meant. So much for self-documenting code 😉
Right, you can abuse it, and it all boils down to conventions.
I don’t think that instead of // TODO: Find a better name for this local variable
you’d rather throw, right?
There’s place for comments, and there’s place for throwing (take a look at HackExpiredException I talked about here: kozmic.pl/…/…-there-be-dragons-in-my-code.aspx )