Sublime Debug Killer

Find debug statements unintentionally left behind in your code

Download as .zip Download as .tar.gz View on GitHub

Sublime Debug Killer - Project Config

Home Global Config Project Config

In the section titled Global Config we talked about how to configure patterns for the plugin to identify based on the scope of the current file being edited. In this section we'll talk about how you can also add patterns at the project level.

At times it might be desirable to have the Debug Killer plugin look for certain patterns based on what Sublime project you are working on. This is useful is many ways. For example you may be working on a project that uses a specific framework that has special logging functions. You may want Debug Killer to look for these logging functions while only working in this project.


Example

Let's pretend we have a project open and we want to add a check for the debug framework method called debugMe(). Here's how. First in Sublime click the Project menu and selected Edit Project. You should see something that looks like this:

{
   "folders":
   [
      {
         "path": "/home/me/code/python/my-project"
      }
   ]
}

The above is what a typical project file looks like. One cool feature about Sublime is how easy it is to add custom settings to any project. This is done by adding a settings key and adding whatever you wish. To add custom patterns at a project-level you will need to first add a settings key that contains another dictionary called sublime-debugkiller. Under that should be a key named patterns that is a list (array) of patterns, much like those found in the global settings file. Here's a sample based on our imaginary debug method named debugMe().

{
   "folders":
   [
      {
         "path": "/home/me/code/python/my-project"
      }
   ],
   "settings": {
      "sublime-debugkiller": {
         "patterns": [
            {
               "pattern": "debugMe\\s(.*?)",
               "scopes": [
                  "source.python"
               ]
            }
         ]
      }
   }
}

Now, when working in this project and you press the key sequence to activate Debug Killer this pattern will be added to the global list. If the file being examined is a Python file it will find all instances of the debugMe() method call.