Hi there! I’m hoping to use Sublime’s build system to run an automatic code formatter for individual files. In this case, I’m using hackfmt, a command-line formatter for the Hack language. This tool takes the name of a file as its argument, and overwrites the same file with the formatted text.
When run directly from shell, hackfmt takes around 0.03 seconds, i.e., nearly instantaneous. However, when I execute it using Sublime’s build system, it takes 0.7 seconds, and there is a noticeable, distracting blip. As a reflex, I save at almost every edit I make, which means this delay is pretty significant.
I’m curious if there’s a way to profile this operation to see what might be going on here. It’s possible other plugins of mine are interfering, or maybe that’s just how long it takes Sublime to reload a file when its contents have changed on disk. Similar tools like the automatic Golang formatter run via the GoSublime package feel nearly instantaneous.
For reference, I’m running on MacOS High Sierra, and have the following build config file:
{
"shell_cmd": "/path_to_hackfmt/hackfmt $file"
}