Pages

Custom PyCharm TODO's

If you're like most developers, todos are you best friend. You can stub out a new method or function, add in the todos to remind you what each piece is for and go on to the next stub without missing a beat. It's nice. Pycharm, like most ide's, highlights todos and even indexes them for searching later on. You can view them later in your ToDo tool window. It's very convenient.

I recently discovered the ToDo setting in Pycharm's preferences and the ability to create custom filters for your todos. It's amazing.

Personally, I've been creating user specific todos for a long time. As I'm coding I'll throw in a line of python to tell me to do something later


The problem with just adding your name to the todo is now you have to sift through all the todos in your code looking for your name. That's not too big of an issue if you generally have small projects, but if you use any open-source packages or javascript files I guarantee you'll be sifting through other peoples' todos.


So here's the solve:


Create Custom ToDo Filters
  1. Open ToDo Settings. (Preferences > IDE Settings > TODO)
  2. Add a new pattern
    1. Click the "+" in the pattern pane.
    2. Type in your pattern.
      **NOTE: Be very careful of what patterns you use. If you make your pattern to generic your machine will be indexing for hours.
    3. Set up your color scheme if you want.
    4. Click "OK"
  3. Add a new filter using your pattern
    1. Click the "+" in the filter pane.
    2. Give your filter a name.
    3. Check the box next to the pattern you just created previously.
    4. Click "OK"
  4. When you click the "OK" button in the ToDo preferences dialog PyCharm will automatically start indexing all of your todos.
It's as simple as that. Now, in your ToDo tool window, you can use your filters to show just the todos that you want. I've used filters to separate todos for users (such as myself) and even projects.