Skip to content

Instantly share code, notes, and snippets.

@WhoAteDaCake
Created July 4, 2018 09:04
Show Gist options
  • Save WhoAteDaCake/9290d98d41fa0621e4c7d8c61d762836 to your computer and use it in GitHub Desktop.
Save WhoAteDaCake/9290d98d41fa0621e4c7d8c61d762836 to your computer and use it in GitHub Desktop.
Sublime reason format on save
# https://stackoverflow.com/questions/42233292/sublimetext-typescript-format-on-save
import sublime
import sublime_plugin
import subprocess
class FormatReasonOnSave(sublime_plugin.EventListener):
def on_pre_save(self, view):
if "Reason" in view.settings().get("syntax"):
subprocess.Popen(['refmt', '--in-place', view.file_name()],
stdout=subprocess.PIPE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment