11 ms·
Recently I decided that I was going to solve the problem of: I easily write inline TODO comments while I work on code, but then have difficulty keeping track of
by mntmoss 7y ago
Recently I decided that I was going to solve the problem of: I easily write inline TODO comments while I work on code, but then have difficulty keeping track of them and getting my head back into the state of things later. While there is IDE support for such things, it's usually not exactly the right interface I want.
So I made a tiny CLI app that scans the source for TODO and FIXME lines and presents a menu of files, containing the number of items to work on in each. Then I type in which file I want to work on and it instantly reports all relevant lines, plus successive comment lines. All I have to do is punch in the line number and start working.
I felt a kind of stress relief almost instantly after doing this. It's better than Trello for me.
If I need to add additional kinds of data sources, many syntaxes, etc. it might become a bit more complex, but still managable as long as there's an API to get some plaintext lines out. It's basically following up on the hypothesis of a lot of information tools today: it isn't the data generation that's the issue, but the filtering.
- BMorearty 7y agoNice idea. The JetBrains family of IDEs (RubyMine, IntelliJ, etc.) even have this as a built-in TODO panel that shows files with TODO and FIXME comments (syntax is configurable).
- yawgmoth 7y agoVisual Studio does the same ("Task List")
- daveslash 7y agoI really like JetBrain's Resharper for Visual Studio -- they have a very nice, flexible, and configurable 'TODO' window. For example, on our team we try to put TODO followed by our name or initials. The TODO window can then partition those out into separate lists.
- gregoryl 7y agoGive Rider a go. I'm a complete convert; previous attempts were very unpleasant, but its a complete experience now, very similar feel to VS + RS, without the awful latency.
- keithnz 7y agoI cannot second this enough, Rider is so much nicer than VS these days. I too tried to convert to Rider previously and ended up not using it, but just a while ago I made the switch and spent some time watching some videos on what toys it has, and going through everything and configuring it how I like. It is a lot nicer and a lot quicker, and most importantly to me, has really good vim support (including easymotion / surround ).
- daveslash 7y agoI've seen it, but never taken the plunge. Thank you for the encouragement -- I'll definitely give it a go. That said, it's going to be extremely difficult to actually incorporate this in my 9-5 environment, so it will probably end up being for my home projects only.
- keithnz 7y agoout of interest, why do you think it'd be hard? It's what I did, just swapped over at work. Nearly everyone else is still using visual studio. It mostly is a zero friction change and you can swap back and forward between environments at any stage
- daveslash 7y agoBecause I work in a highly regulated industry. We have to qualify/verify/validate everything that we use, and we all have to be standardized on the same thing. I'm currently struggling to get unit tests working smoothly -- we have to validate the "plugin" that we use to execute the unit tests (MSTest... part of Visual Studio), which means that we need to write requirements and then test those requirements. We're writing requirements for MSTest.... I'm pushing to get a CI pipeline set up so that our unit tests can be run automatically with every check-in, but we'll have to write-up requirements for whatever CI tool, validate that it works with our existing source control, validate that the unit tests execute properly, document it all, review it all, sign off on it all within our document control system. etc... Switching to an entirely new IDE I think would make people's heads explode. Personally I think that we make things excessively hard on ourselves -- I'm endeavoring to reduce some of that pain.
- keyle 7y agoI use IntelliJ as well for years, but don't underestimate grep -r "# TODO" .
- tyingq 7y agogrep -H "# TODO" file1 dir1/* file2 Is also useful, as it prints the filename and the matching lines.
- asicsp 7y agoif you are using GNU grep, -H option gets enabled by default when there are multiple input files
- imjasonmiller 7y agoThat’s great! Using ripgrep [1], I think it would even exclude all from your .gitignore by default. I’ll give this a try before adding something to my .vimrc again. 1. https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep
- sverhagen 7y agoThis only works depending on how diligently you formatted those TODOs. Before you know it your regex explodes. I use IntelliJ as well, so I don't have to think about these problems.
- 7y ago
- skipants 7y agoRails (or maybe it's just Rake) has `rake notes`
- tekknolagi 7y agoHave you considered open-sourcing this CLI app? I would benefit immensely from this tool, I think. Right now I just kind of ack and hope for the best.
- deleted 7y ago[deleted]
- aeneasmackenzie 7y agoCheck out lentil: http://hackage.haskell.org/package/lentil http://hackage.haskell.org/package/lentil
- jchook 7y agoeslint does this for JavaScript with the no-warning-comment rule. The general idea there goes something like "don't use code comments as a project management tool," but I tend to use eslint as a reminder to finish things for my current PR. Also it occurred to me you could use grep or rg, something like... rg '\s*//\s*TODO'
- useragent86 7y agoEmacs supports this with the package magit-todos.
- sevencolors 7y agoThere's extension for VS Code - Todo Tree that organizes your files with TODO in the comments. Super helpful https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree https://marketplace.visualstudio.com/items?itemName=Gruntfug...
- yonilevy 7y agoI do something similar, but my flow is around feature branches: I create a branch, dumping TODOs in the code as I work out the feature, then progressively fix them before merging the branch. Wrote a little script to highlight TODOs created in current branch (vs base) if anyone's interested: https://github.com/yonilevy/branchtodo https://github.com/yonilevy/branchtodo
- jamiesonbecker 7y agoThis will open all of the files with TODO in them in vim: alias todogrep="vim $(grep TODO . -rl)" You can modify this easily, such as by using ripgrep, adding excludes, or doing regex to find TODO and FIXME together, but this is a quick one-liner to add to your `.bashrc`.
- CDRdude 7y agoYou can put the grep flags at the end? All these years, and I had no idea.
- yencabulator 7y agoDepends on your grep. Reordering flags is typically a GNU getopts extension, not present in traditional UNIXes.
- wruza 7y ago:set wildignore+=node_modules/** :nmap gr :vimgrep '' **/* \| copen 20<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left> grTODO, enter. Edit: <C-f>0wa may work instead of Lefts, but I always forget about it.
- hboon 7y agoRelated to this. I write comments for TODOs that I want completed before I commit with a special prefix like: //hhh I want this to be done before I commit. Then have a git pre-commit hook that scans for "//hhh" and aborts if it's found.
- nine_k 7y agoSame with XXX instead, which even gets auto-highlighted by many editors.
- edwinyzh 7y agoI've been doing this for decades: http://www.gexperts.org/tour/index.html?to_do_list.html http://www.gexperts.org/tour/index.html?to_do_list.html
- chch 7y agoJust be careful about Microsoft's Patent US6748582B1; it doesn't expire for another few months. ;) From the patent (edited down a bit): > According to various example implementations of the invention, a task list facilitates code development by assisting developers in keeping track of and managing a variety of tasks, such as errors to be corrected, opportunities for optimization, and other user-defined tasks. As the developer edits source code, warnings and coding errors are detected and inserted as tasks in a task list. The developer can also embed keywords known as comment tokens in the code. These comment tokens are detected and used to define tasks. > [...] > Tasks can also be identified using tokens or keywords. These tokens or keywords typically preface comment lines in the code and may include predefined labels such as, for example, “UNDONE,” “TODO,” or “HACK,” as well as labels that are defined by the individual developer. If the source code has no syntax errors, the parser [...] determines whether any of the keywords are present in the source code[.] If so, [it] extracts the comment from the source code and uses the tag to determine the priority of the task. The task is then inserted in the task list[.] For example, if the source code contains the comment, “/TODO: Need to add copyright text/”, the parser [...] adds the task “TODO: Need to add copyright text” to the task list with a priority rating assigned to the “TODO” tag. [1] [1] http://patents.google.com/patent/US6748582B1/en http://patents.google.com/patent/US6748582B1/en
- arminiusreturns 7y agoHow is it you are aware of this? Affiliation with MS or a project that ran into it? Wouldn't the key part: "and in response to completion of a task, modifying the task list during the interactive code development session to indicate that the task has been completed." mean it doesn't apply? Worst case, just put a US exclusionary clause in the release so US copyright law doesn't apply. At least Europe is ahead of the US in this and doesn't allow such trivial patents and considers them invalid by definition.
- nojvek 7y agoI am an X-Microsoft employee. Pre-Nadella era, most teams had a patent budget. People would file patents for all sorts of reasons. The game was who can get away with vague-ish patents and collect the most cubes. There was a cube you got per patent. Needless to say the number of cubes someone had, the more clout they had and it became a dick measuring contest. There are VPs and distinguished engineers with 100s of cubes.
- dingo_bat 7y ago> So I made a tiny CLI app that scans the source for TODO and FIXME lines and presents a menu of files, containing the number of items to work on in each. Then I type in which file I want to work on and it instantly reports all relevant lines, plus successive comment lines. All I have to do is punch in the line number and start working. Isn't this exactly like how cscope works?
- unkulunkulu 7y agoYou reminded me of the time one cool guy and a respectable troll ran a script to create tons of issues on github for TODO comments in the code. He quickly got banned and the issues removed, but I for one was thankful to him. I think I asked the staff to get them back for my repo, but no :)
- agustif 7y agoThis could be a Great GitHub Actions though. So user can enable/disable it per account/repo as they wish. I think it exists, I've had it enabled in some repo when figuring out new gh actions
- agustif 7y agohttps://github.com/marketplace/actions/todo-actions https://github.com/marketplace/actions/todo-actions https://github.com/JasonEtco/todo https://github.com/JasonEtco/todo