While writing my first ever Sublime Text plugin, I had a hell of a time figuring out a proper development workflow that worked for me and even searching on ST's forum didn't really turn up anything helpful. Â A few of the problems I experienced were
- Code changes not being registered by ST and thus leading me to restart it only to run into problem #2.
- Having my code deleted by ST on restart.
- Default settings didn't seem to be read in correctly.
- ...
How much of my problems stemmed from being a relative novice with Python vs ST specific issues, I'm unsure. Â However I will go further in saying that the thing I missed most from node.js development is using something like node's --inspect flag and Chrome DevTools which allows one to step through code as well as to inspect program state. Â Without knowledge of a similar tool for Python, I reverted back to console logging which in this case included a bunch of print() usage before getting a properly configured logging setup (again, not sure which was at fault Python/ST but in this case I have a strong feeling it was ST specific as code reloading was broken). Â Maybe the reader is familiar with both universes and knows of some Python tooling which is similar to node's inspect... Â

At a certain point I really missed the simplicity that is my Node.js workflow, felt much like the dude above, and I even tried naively to run Grunt inside of my project working directory (Python) thinking that I could use grunt watch to reload my ST plugin on updates, which probably should work but that path got cut short when I got the error about grunt needing to be installed locally. Â I didn't want to install node.js dependencies (even dev only dependencies) for a Python project. Â So I ended up writing a quick shell script to solve all of my woes! Â Even though I'm on Windows 10 (yeah, yeah, I know) WSL gave me the option to avoid cmd/PowerShell, etc (cause I have no desire) and go straight to the familiar shell to write this simple script watchSublimePluginDevelopment.sh
which leverages inotifywait:
while inotifywait -q --event modify --format '%w' ~/me/AppData/Roaming/Sublime\ Text\ 3/Pristine\ Packages/Jenkinsfile/*.py; do
cd ~/me/AppData/Roaming/Sublime\ Text\ 3/Packages/
rm Jenkinsfile
ls -la ~/me/AppData/Roaming/Sublime\ Text\ 3/Packages
echo Detected change.
sleep 3;
ln -s ../Pristine\ Packages/Jenkinsfile/
ls -la ~/me/AppData/Roaming/Sublime\ Text\ 3/Packages
done
My working directory under git control is:
~/me/AppData/Roaming/Sublime\ Text\ 3/Pristine\ Packages/Jenkinsfile
Now any changes to my Jenkinsfile plugin code will be detected by the script and subsequently reloaded by ST. Â Seems removing/adding the symlink from the Packages directory works like a charm to make ST unload/reload the plugin code. Â I needed to introduce a bit of a delay because without it, ST didn't notice the change.