RustAutoImport
Automatically add use statement imports for Rust from ST3
Details
Installs
- Total 2K
- Win 1K
- Mac 468
- Linux 701
May 21 | May 20 | May 19 | May 18 | May 17 | May 16 | May 15 | May 14 | May 13 | May 12 | May 11 | May 10 | May 9 | May 8 | May 7 | May 6 | May 5 | May 4 | May 3 | May 2 | May 1 | Apr 30 | Apr 29 | Apr 28 | Apr 27 | Apr 26 | Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Readme
- Source
- raw.githubusercontent.com
Sublime Rust Auto-Import
This is a Sublime Text 3 plugin for automatically creating imports in Rust.
It provides the rust_auto_import
command which you can bind to a key (or use from the context menu or command pallete). When used with the cursor on an identifier, it automatically use
s the (hopefully) correct path at the top of the file.
Features
- Uses Sublime's index to find the module for items in the current crate
- Has a pre-programmed list of common
std
imports likeHashMap
- Even some traits like
std::str::From
with your cursor onfrom_str
- Even some traits like
- Places new imports under the existing import with the most similar prefix
- Adds in brackets if an import from that module already exists
- Adds the old position to the jump stack so you can hit
ctrl+-
to jump back to where you were
Demo GIF
Installation
Install RustAutoImport from Package Control.
Then add a keybinding of your choice for the rust_auto_import
command, by adding a line like this to your keybindings file:
{ "keys": ["ctrl+a"], "command": "rust_auto_import" },
You can also try it out immediately by choosing “Rust: auto-import” from the context menu or command pallete.
Disclaimers
Feel free to send a PR if you want to fix one of these.
- Currently uses the 2018 edition import style with no setting to change it
- Only includes a limited set of standard library includes
- Uses hacky regexes instead of real parsing
- Doesn't fully support nested braced imports
- Can only add to top-level imports not imports in a test module