Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Commands/Fmt on Save.tmCommand
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/bin/bash

cd $TM_PROJECT_DIRECTORY
: ${CARGO_HOME=$HOME/.cargo} &amp;&amp; export CARGO_HOME
$CARGO_HOME/bin/rustfmt --emit stdout
</string>
<key>input</key>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>hideFromUser</key>
<true/>
<key>name</key>
<string>Fmt on Save</string>
<key>outputCaret</key>
<string>interpolateByLine</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>replaceDocument</string>
<key>scope</key>
<string>source.rust</string>
<key>semanticClass</key>
<string>callback.document.will-save.100</string>
<key>uuid</key>
<string>83ef2c73-1a43-48de-9fb5-a52cb6ad4540</string>
<key>version</key>
<integer>1</integer>
</dict>
</plist>
12 changes: 6 additions & 6 deletions Commands/Format.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<string>nop</string>
<key>command</key>
<string>#!/bin/bash

cd $TM_PROJECT_DIRECTORY
: ${CARGO_HOME=$HOME/.cargo} &amp;&amp; export CARGO_HOME
$CARGO_HOME/bin/rustfmt $TM_FILEPATH
$CARGO_HOME/bin/rustfmt --emit stdout
</string>
<key>input</key>
<string>none</string>
<string>document</string>
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@R</string>
<key>name</key>
<string>Format</string>
<key>outputCaret</key>
<string>afterOutput</string>
<string>interpolateByLine</string>
<key>outputFormat</key>
<string>text</string>
<key>outputLocation</key>
<string>discard</string>
<string>replaceDocument</string>
<key>scope</key>
<string>source.rust</string>
<key>uuid</key>
<string>62C653C0-B18A-4B68-9598-32972B821814</string>
<key>version</key>
<integer>2</integer>
<integer>3</integer>
</dict>
</plist>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ tmb update rust
</tr>
</table>

- 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)
Expand Down