RustAutoImport
Automatically add use statement imports for Rust from ST3
Details
Installs
- Total 2K
- Win 1K
- Mac 455
- Linux 674
Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 2 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 |
Linux | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
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