I have some Python-related snippets that I use for unit testing:
ae -> self.assertEqual(a, b)
at -> self.assertTrue(x)
ar -> self.assertRaises(exc, fun)
...
These auto-completions are useful only when writing unit tests, so I would like to enable them only if the file I’m editing contains “test”` in its base name.
Similarly, I have ST builds which are specific for unit tests (e.g. “Test This File”): I would like to enable these builds only when I’m editing a Python file and file has "test"
in its base name.
Is there a way to programmatically add scopes/contexts based on the file name (e.g. via EventListener.on_load
)?