Rust Racer Autocomplete

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Rust Racer Autocomplete

Post by jussij »

The latest Zeus release adds support for the Rust programming language.

The latest version can be found here: http://zeusedit.com/z300/ze32v398f.zip

The latest version adds compiler support as well as autocomplete, code navigation and tooltips.

Rust Installation and Setup

To compile Rust code inside Zeus the Rust compiler must be installed and the Rust bin folder must be defined in the system PATH environment variable.

For the autocomplete, code navigation and tooltips to work the Racer tool needs to have been installed and also located in the PATH.

The tool Racer can be found here: https://github.com/phildawes/racer

For the Racer tool to work it also needs the RUST_SRC_PATH environment variable defined and pointing to the root folder of the Rust source code.

Depending on which version of Rust you install, you may also need to configure the environment for the linker.

If you are running the Visual Studio version and get this error, it means the Visual Studio environment has not been correctly configured:

Code: Select all

error: could not exec the linker `link.exe`: The system cannot find the file specified. (os error 2)
Code Complete
Consider this example code (where the '|' represent the cursor):

Code: Select all

use std;

fn main() {
    std::io::B|
}
Using the Macros tab found on the Navigator panel and running the Racer - Autocomplete macro will result in this popup display:
rust_tooltip.png
rust_tooltip.png (2.71 KiB) Viewed 30663 times
That auto complete would also automatically fire in this situation, after typing in the ':' character:

Code: Select all

fn main() {
    std::io::|
}
Code Navigation
Consider this example code where the cursor is located on the Broadcast word:

Code: Select all

use std;

fn main() {
    std::io::Broadcast
}
Using the Macros tab and running the Racer - Goto Definition macro will result in this the loading of the rust\src\libstd\io\mod.rs file at a locate containing the piece of code:

Code: Select all

/// A `Write` adaptor which will write data to multiple locations.
///
/// This struct is generally created by calling [`broadcast()`][broadcast] on a
/// writer. Please see the documentation of `broadcast()` for more details.
///
/// [broadcast]: trait.Write.html#method.broadcast
#[unstable(feature = "io", reason = "awaiting stability of Write::broadcast",
           issue = "27802")]
pub struct Broadcast<T, U> {
    first: T,
    second: U,
}
Rust Tooltips
Consider this example code where the cursor is located on the _print word:

Code: Select all

use std::*;

fn main() {
    std::io::_print(
}
Using the Macros tab and running the Racer - Display Tooltip macro will result in the tooltip popup display shown below:
rust_autocomplete.png
rust_autocomplete.png (4.01 KiB) Viewed 30663 times
Post Reply