Coder Social home page Coder Social logo

atom-ide-rust's Introduction

IDE-Rust

Rust language support for Atom-IDE, powered by the Rust Language Server (RLS).

Features

  • Auto-completion
  • Diagnostics (errors and warnings from rustc and clippy, see clippy_preference setting)
  • Document outline
  • Go to definition (ctrl or cmd click)
  • Type information and Documentation on hover (hold ctrl or cmd for more information)
  • Find references (ctrl-alt-shift-f or cmd-opt-shift-f also in context menu)
  • Format file with rustfmt (ctrl-shift-c or cmd-shift-c also in context menu)
  • Format on save (disabled by default, see atom-ide-ui settings)
  • Supports rustup default & override toolchains, or manually select rls toolchain in package settings
  • Rls toolchain update checking at startup & every 6 hours thereafter
  • Global Rls configuration for all_targets, clippy_preference
  • Per-project Rls configuration using rls.toml file at project root, see rls#configuration
    # rls.toml
    features = ["serde"]
  • Graceful handling of Rls being missing from the distribution (which is/was somewhat common on the nightly channel)
    • Warns before installing a rust version without Rls or when using an already installed one
    • Automatic detection of, and prompt to install, the latest working dated release
  • Rust language snippets

Install

You can install from the command line with:

$ apm install ide-rust

Or you can install from Settings view by searching for ide-rust.

No other packages or manual setup is required as these will be handled with user prompts after install. However, you may wish to install rustup with your OS package manager instead of following prompts to install via rustup.rs.

Commands

  • ide-rust:restart-all-language-servers Restart all currently active Rls processes

Multi-crate projects

A root Cargo.toml is required in each atom project, however cargo workspaces can be used to support multiple crates in a single project. For example, a project with 'rust_foo' & 'rust_bar' directories/crates could have the following root Cargo.toml

# Cargo.toml
[workspace]
members = [
    "rust_foo",
    "rust_bar",
]

Even if you only have a single crate in your Atom project, RLS can only detect it if you have a root Cargo.toml. If your project is setup such that you have one or more crate nested in folders under the root, you can add a root Cargo.toml file and setup a Cargo workspace that includes all the crates in the project:

# Cargo.toml
[workspace]
members = [
    "foo/bar/rust_foo",
]

Overriding Rls

The Rls command can be specified manually, for example to run from local source code:

# config.cson
  ...
  "ide-rust":
    rlsCommandOverride: "cargo +nightly run --manifest-path=/rls-src/Cargo.toml"

When set you'll be able to see, and remove, this from the package settings. After restarting atom an info message will inform you the override is in place.

Debugging IDE-Rust

If stuff isn't working you can try enabling logging to debug:

  • Open the atom console (ctrl-shift-i)
  • Enter atom.config.set('core.debugLSP', true)
  • Reload atom (ctrl-shift-F5)

This will spit out language server message logging into the atom console. Check if requests/responses are being sent or are incorrect. It will also include any Rls stderr messages (as warnings) which may point to Rls bugs.

License

MIT License. See the license for more details.

atom-ide-rust's People

Contributors

adrian5 avatar aldonogueira avatar alexheretic avatar barbeque avatar dannyfritz avatar ghisvail avatar jacobmischka avatar mehcode avatar okbel avatar randompoison avatar sunjay avatar

Watchers

 avatar

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.