diff --git a/Commands/Fmt on Save.tmCommand b/Commands/Fmt on Save.tmCommand new file mode 100644 index 0000000..9375102 --- /dev/null +++ b/Commands/Fmt on Save.tmCommand @@ -0,0 +1,37 @@ + + + + + beforeRunningCommand + nop + command + #!/bin/bash + +cd $TM_PROJECT_DIRECTORY +: ${CARGO_HOME=$HOME/.cargo} && export CARGO_HOME +$CARGO_HOME/bin/rustfmt --emit stdout + + input + document + inputFormat + text + hideFromUser + + name + Fmt on Save + outputCaret + interpolateByLine + outputFormat + text + outputLocation + replaceDocument + scope + source.rust + semanticClass + callback.document.will-save.100 + uuid + 83ef2c73-1a43-48de-9fb5-a52cb6ad4540 + version + 1 + + \ No newline at end of file diff --git a/Commands/Format.tmCommand b/Commands/Format.tmCommand index c35aec9..f55da2f 100644 --- a/Commands/Format.tmCommand +++ b/Commands/Format.tmCommand @@ -3,16 +3,16 @@ beforeRunningCommand - saveActiveFile + nop command #!/bin/bash cd $TM_PROJECT_DIRECTORY : ${CARGO_HOME=$HOME/.cargo} && export CARGO_HOME -$CARGO_HOME/bin/rustfmt $TM_FILEPATH +$CARGO_HOME/bin/rustfmt --emit stdout input - none + document inputFormat text keyEquivalent @@ -20,16 +20,16 @@ $CARGO_HOME/bin/rustfmt $TM_FILEPATH name Format outputCaret - afterOutput + interpolateByLine outputFormat text outputLocation - discard + replaceDocument scope source.rust uuid 62C653C0-B18A-4B68-9598-32972B821814 version - 2 + 3 diff --git a/README.md b/README.md index 2bd4070..3366c6a 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,14 @@ tmb update rust +- rustfmt auto run on save (see instructions below to disable) - Autocompletion when racer is available (see instructions below) +## How to disable format on save + + - Bundles menu > Edit Bundles > Rust > Other Actions > Fmt on save > Uncheck "Enable this item" + + ## How to enable autocompletion via racer - Install racer by following [the instructions in racer's README](https://github.com/phildawes/racer)