Code Monkey home page Code Monkey logo

rustautocomplete's Introduction

RustAutoComplete

A binding for Sublime Text to the Rust auto completion tool by Phil Dawes (https://github.com/phildawes/racer).

Features

  • Auto complete (invoked automatically on Rust files).
  • Go to definition (default key binding is F2).

Example

Example

Status

Initial version. Works on the basic projects I have tested on. Partially works on Servo when the search paths are set correctly.

Pull requests for fixes and new features are very welcome.

I have only tested this on Linux (Ubuntu 14.04). It may work on Mac / Windows.

Requirements

  1. Install the Rust syntax highlighting package from Package Control: https://sublime.wbond.net/packages/Rust
  2. Clone and build the auto completion tool racer: https://github.com/phildawes/racer
  3. Install the package through package control (or clone from git if you prefer): https://sublime.wbond.net/packages/RustAutoComplete
  4. Configure the plugin to be able to find the racer executable and Rust source code. Open menu Preferences -> Package settings -> RustAutoComplete -> Settings - User and edit the settings file using below as a template:
{
  // The full path to the racer binary. If racer is already
  // in your system path, then this default will be fine.
  "racer": "racer",

  // A list of search paths. This should generally just
  // be the path to the rust compiler src/ directory.
  "search_paths": [
    "/home/git/rust-lang/rust/src"
  ]
}

Contact

https://github.com/glennw/RustAutoComplete

rustautocomplete's People

Contributors

artemgr avatar byron avatar defuz avatar gentoo90 avatar glennw avatar golddranks avatar gw3583 avatar mriehl avatar nickmab avatar porglezomp avatar szotp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rustautocomplete's Issues

OS X: Completion is not working

I have installed the latest version of racer and it worked fine. Here are some testing output from racer

$ racer complete "std::io::B"
MATCH BufReader,266,11,/Users/zonyitoo/Projects/rust/src/libstd/io/mem.rs,Struct,pub struct BufReader<'a> {
MATCH BufWriter,205,11,/Users/zonyitoo/Projects/rust/src/libstd/io/mem.rs,Struct,pub struct BufWriter<'a> {
MATCH BufferedReader,47,11,/Users/zonyitoo/Projects/rust/src/libstd/io/buffered.rs,Struct,pub struct BufferedReader<R> {
MATCH BufferedWriter,139,11,/Users/zonyitoo/Projects/rust/src/libstd/io/buffered.rs,Struct,pub struct BufferedWriter<W> {
MATCH BufferedStream,307,11,/Users/zonyitoo/Projects/rust/src/libstd/io/buffered.rs,Struct,pub struct BufferedStream<S> {
MATCH BrokenPipe,461,4,/Users/zonyitoo/Projects/rust/src/libstd/io/mod.rs,EnumVariant,BrokenPipe,
MATCH Buffer,1404,10,/Users/zonyitoo/Projects/rust/src/libstd/io/mod.rs,Trait,pub trait Buffer: Reader {

RustAutoComplete can find the binary of racer, but it is not able to complete any thing except variable names.

qq20141016-2 2x

qq20141016-3 2x

Not working on Windows

I have racer installed and I am able to get code completions on the command line
C:\Users\nsrinivasan>racer complete std::io::B MATCH BufReader,323,11,C:\n\rust\src\libstd\io\mem.rs,Struct,pub struct BufReade r<'a> { MATCH BufWriter,253,11,C:\n\rust\src\libstd\io\mem.rs,Struct,pub struct BufWrite r<'a> { MATCH BufferedReader,48,11,C:\n\rust\src\libstd\io\buffered.rs,Struct,pub struct BufferedReader<R> { MATCH BufferedWriter,153,11,C:\n\rust\src\libstd\io\buffered.rs,Struct,pub struc t BufferedWriter<W> { MATCH BufferedStream,339,11,C:\n\rust\src\libstd\io\buffered.rs,Struct,pub struc t BufferedStream<S> { MATCH ByRefReader,868,10,C:\n\rust\src\libstd\io\mod.rs,Trait,pub trait ByRefRea der { MATCH BytesReader,883,10,C:\n\rust\src\libstd\io\mod.rs,Trait,pub trait BytesRea der { MATCH ByRefWriter,1231,10,C:\n\rust\src\libstd\io\mod.rs,Trait,pub trait ByRefWr iter { MATCH Buffer,1372,10,C:\n\rust\src\libstd\io\mod.rs,Trait,pub trait Buffer: Read er { MATCH BufferPrelude,1504,10,C:\n\rust\src\libstd\io\mod.rs,Trait,pub trait Buffe rPrelude { MATCH BrokenPipe,396,4,C:\n\rust\src\libstd\io\mod.rs,EnumVariant,BrokenPipe,

Here is my settings on RustAutoComplete on sublime

{
// The full path to the racer binary. If racer is already
// in your system path, then this default will be fine.
"racer": "racer",

// A list of search paths. This should generally just  

// be the path to the rust compiler src/ directory.
"search_paths": [
"c:\n\rust\src"]
}

Any suggestions as to what could be the issue?

Not working on OSX and generate lots of tmp files.

RustAutoComplete v0.8.0
SublimeText 3.0 beta 3083

Snapshot:
2016-01-06 4 45 18

It is not show up the completion and generate lots of tmp files in rust src/ directory.

My Config is

{
    "racer": "racer",

    "search_paths": [
        "/path/to/rustc-1.5.0/src"
    ]
}

racer is already into $PATH, and RUST_SRC_PATH already set.

Plugin doesn't work after the last RustAutoComplete.py modification

I've tried to download the latest RustAutoComplete plugin from github with modified RustAutoComplete.py file, which enables better autocompletion, but the autocompletion just doesn't work.
But when I put the old plugin, everything works fine.

Is it only by me, or is there anyone with the same problem ?

Creates 20+ temp files and doesn't delete them.

I noticed all of these temp files (tmp[random chars]) being created beside my source files. They were multiplying pretty fast. I can see it starting when the autocomplete popup is shown, and the more you type, the more it creates. They aren't being deleted though. If I close Sublime Text (version 3065) they are still there. Disabling 'RustAutoComplete' stops them from being created.

Any ideas on how to remedy this? I do like RustAutoComplete. It works fine except for the this one thing.

Allow CARGO_HOME to be set in config

With a Multirust-rs/Rustup installation, the search path is no longer necessary, instead there is CARGO_HOME, which is needed to enable autocompletion on third-party crates. Can RustAutoComplete support that?

Non-ascii characters break the completion

The search through standard libraries works on Sublime Text 3 / OS X Yosemite, but whenever I have non-ascii characters in my code, it breaks, the completion results don't pop out anymore.

For example:
let message = "Ärgh";

makes it break.

However, whenever I use racer directly with line and col number and filename, it works without problems. Thus, it seems to be a problem in RustAutoComplete.

Menu items for keymap editing

I want to change key binding for rust_goto_definition command, but I have to create .sublime-keymap
file manually. Please, add ability to create custom keymap from sublime.

can't autocomplete until input a letter

My sublime keybind { "keys": ["ctrl+space"], "command": "auto_complete" }, now i must use this way to call the autocomplete without input a letter. how to fix it ?? I have use the newest racer

auto_complete_triggers not working

This is my config file

{
	// The full path to the racer binary. If racer is already
	// in your system path, then this default will be fine.
	"racer": "/Users/luis/.cargo/bin/racer",

	// A list of search paths. This should generally just
	// be the path to the rust compiler src/ directory.
	"search_paths": [
	  "/Users/luis/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src"
	]
}

every time I writing something

use std::

I get no hints or suggestions. Is there anything wrong in my config file or that i can add/edit to make this work?

It's not an issue, but a request.

I've only started today with Rust, so If I'm wrong, or my code is wrong, don't judge me :)
As I understood my autocompletion works
screenshot from 2014-10-05 15 42 43

Still something is wrong (or maybe rust is updating too quickly :) ), cause when I try to test the code you've written no suggestions are shown (like new, with_hasher etc.)
screenshot from 2014-10-05 15 44 11

What I find cool, is that it also searches your current file for autocompletion. That's awesome.
It would be great, if autocompletion could show the return type of the function. I'm sure it's a good feature.
screenshot from 2014-10-05 15 56 53

No autocompletion for println, or stuff like to_string etc.
screenshot from 2014-10-05 16 22 49
screenshot from 2014-10-05 16 23 00

P.S. I didn't want to write it in Issue section, but I couldn't find your mail. Thanks in advance.

Add project include paths to RACER search paths

This would be nice, and I will make a pull request soon if I am able, but I'm relatively unfamiliar with sublime plugin development and it's been years since I've seriously touched python, so bear with me.

Coming from DKit, more interaction with sublime's project system in general would be very useful, but given the state of racer-rust/racer#73, that may have to wait.

Crashes on "f"

Hi,

as soon as I type f in sublime, racer.exe crashes . Auto-completion works for everything else and when I execute racer complete f from command-line, it finds this:

 $ racer complete f
 MATCH flate,1,0,\Rust\rust\src\libflate\lib.rs,Module,flate
 MATCH fmt_macros,1,0,\Rust\rust\src\libfmt_macros\lib.rs,Module,

Which is why I assume this is a problem with this Plugin, not racer itself. I couldn't find any log that could give us additional information, how would I begin to debug this problem?

I'm on Windows 8.1.

Don't spam the console

I guess that this line spams sublime's console with the current directory. Every some keystrokes a path gets printed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.