{"id":13479319,"url":"https://github.com/neoclide/coc-rls","last_synced_at":"2025-04-04T16:11:22.860Z","repository":{"id":45322833,"uuid":"154857128","full_name":"neoclide/coc-rls","owner":"neoclide","description":"Rust language server support for coc.nvim","archived":false,"fork":false,"pushed_at":"2021-12-21T12:18:07.000Z","size":138,"stargazers_count":389,"open_issues_count":13,"forks_count":19,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T15:09:19.705Z","etag":null,"topics":["coc","neovim","rust","vim"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neoclide.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-26T15:40:15.000Z","updated_at":"2025-02-16T20:39:38.000Z","dependencies_parsed_at":"2022-09-15T20:22:32.609Z","dependency_job_id":null,"html_url":"https://github.com/neoclide/coc-rls","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-rls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-rls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-rls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neoclide%2Fcoc-rls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neoclide","download_url":"https://codeload.github.com/neoclide/coc-rls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208142,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coc","neovim","rust","vim"],"created_at":"2024-07-31T16:02:13.579Z","updated_at":"2025-04-04T16:11:22.839Z","avatar_url":"https://github.com/neoclide.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Language Support"],"sub_categories":[],"readme":"# Rust support for coc.nvim\n\n[![NPM version](https://img.shields.io/npm/v/coc-rls.svg?style=flat-square)](https://www.npmjs.com/package/coc-rls)\n\nIt's fork of [rls-vscode](https://github.com/rust-lang-nursery/rls-vscode).\n\nAdds language support for Rust to [coc.nvim](https://github.com/neoclide/coc.nvim). Supports:\n\n- code completion\n- jump to definition, peek definition, find all references, symbol search\n- types and documentation on hover\n- code formatting\n- refactoring (rename, deglob)\n- error squiggles and apply suggestions from errors\n- snippets\n\nRust support is powered by the [Rust Language Server](https://github.com/rust-lang/rls)\n(RLS). If you don't have it installed, the extension will install it for you.\n\nFor support, please file an [issue on the repo](https://github.com/neoclide/coc-rls/issues/new)\nor talk to us [on Gitter](https://gitter.im/rust-lang/IDEs) or in #rust-dev-tools\non IRC ([Mozilla servers](https://wiki.mozilla.org/IRC)). There is also some\n[troubleshooting and debugging](https://github.com/neoclide/coc.nvim/wiki/Debug-language-server) advice.\n\n**Note:** multiple projects is not supported, you have to use different vim\ninstances.\n\n## Quick start\n\n- Install [rustup](https://www.rustup.rs/) (Rust toolchain manager).\n- Install rust toolchain components.\n\n  ```bash\n  rustup component add rls rust-analysis rust-src\n  ```\n\n- Install this extension in your vim by:\n\n  ```vim\n  :CocInstall coc-rls\n  ```\n\n- (Skip this step if you already have Rust projects that you'd like to work on.)\n  Create a new Rust project by following [these instructions](https://doc.rust-lang.org/book/ch01-03-hello-cargo.html#creating-a-project-with-cargo).\n- Open a Rust project. Open the folder for the whole project (i.e., the folder containing 'Cargo.toml'),\n  not the 'src' folder.\n- You'll be prompted to install the RLS. Once installed, the RLS should start\n  building your project.\n\n## NixOS\n\nNixOS users should use nix-shell or direnv for development. Follow [these instructions](https://nixos.wiki/wiki/Development_environment_with_nix-shell) to set them up first.\n\nThen create two files:\n\n1. An **.envrc** file containing `use_nix`.\n2. Add `\"rust-client.disableRustup\": true` to `coc-settings.json`\n3. And **shell.nix** containing:\n\n```\nlet\n  moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);\n  nixpkgs = import \u003cnixpkgs\u003e { overlays = [ moz_overlay ]; };\n  #rustNightlyChannel = (nixpkgs.rustChannelOf { date = \"2019-01-26\"; channel = \"nightly\"; }).rust;\n  rustStableChannel = nixpkgs.latest.rustChannels.stable.rust.override {\n    extensions = [\n      \"rust-src\"\n      \"rls-preview\"\n      \"clippy-preview\"\n      \"rustfmt-preview\"\n    ];\n  };\nin\n  with nixpkgs;\n  stdenv.mkDerivation {\n    name = \"moz_overlay_shell\";\n    buildInputs = [\n      rustStableChannel\n      rls\n      rustup\n    ];\n  }\n```\n\nEnter the shell in current directory and enjoy developing rust apps + coc.nvim + coc-rls :)\n\nTip: If you want to use nightly channel uncomment that line and use it :)\n\n## Configuration\n\nThis extension provides some options into `coc-settings.json`. These\noptions have names which start with `rust.`. Install [coc-json](https://github.com/neoclide/coc-json)\nfor auto completion support.\n\n- `\"rust-client.enable\"`:\n\n  When set to true, enables this extension. Requires reloading extension after change., default: `true`\n\n- `\"rust-client.logToFile\"`:\n\n  When set to true, RLS stderr is logged to a file at workspace root level. Requires reloading extension after change., default: `false`\n\n- `\"rust-client.setLibPath\"`\n\n  When set to false, environment variable DYLD_LIBRARY_PATH \u0026 LD_LIBRARY_PATH are kept for rls, default: `true`\n\n- `\"rust-client.rustupPath\"`:\n\n  Path to rustup executable. Ignored if rustup is disabled., default: `\"rustup\"`\n\n- `\"rust-client.rlsPath\"`:\n\n  Override RLS path. Only required for RLS developers. If you set this and use rustup, you should also set `rust-client.channel` to ensure your RLS sees the right libraries. If you don't use rustup, make sure to set `rust-client.disableRustup`., default: `null`\n\n- `\"rust-client.revealOutputChannelOn\"`:\n\n  Specifies message severity on which the output channel will be revealed. Requires reloading extension after change., default: `\"never\"`\n\n  Valid options: `[\"info\",\"warn\",\"error\",\"never\"]`\n\n- `\"rust-client.updateOnStartup\"`:\n\n  Update the RLS whenever the extension starts up., default: `false`\n\n- `\"rust-client.disableRustup\"`:\n\n  Disable usage of rustup and use rustc/rls from PATH., default: `false`\n\n- `\"rust-client.channel\"`:\n\n  Rust channel to invoke rustup with. Ignored if rustup is disabled. By default, uses the same channel as your currently open project., default: `null`\n\n  Valid options: `[\"stable\",\"beta\",\"nightly\"]`\n\n- `\"rust-client.trace.server\"`:\n\n  Traces the communication between VS Code and the Rust language server., default: `\"off\"`\n\n  Valid options: `[\"off\",\"messages\",\"verbose\"]`\n\n- `\"rust.sysroot\"`:\n\n  `--sysroot`, default: `null`\n\n- `\"rust.target\"`:\n\n  `--target`, default: `null`\n\n- `\"rust.rustflags\"`:\n\n  Flags added to `RUSTFLAGS`., default: `null`\n\n- `\"rust.clear_env_rust_log\"`:\n\n  Clear the `RUST_LOG` environment variable before running rustc or cargo., default: `true`\n\n- `\"rust.build_lib\"`:\n\n  Specify to run analysis as if running `cargo check --lib`. Use `null` to auto-detect. (unstable), default: `null`\n\n- `\"rust.build_bin\"`:\n\n  Specify to run analysis as if running `cargo check --bin \u003cname\u003e`. Use `null` to auto-detect. (unstable), default: `null`\n\n- `\"rust.cfg_test\"`:\n\n  Build cfg(test) code. (unstable), default: `false`\n\n- `\"rust.unstable_features\"`:\n\n  Enable unstable features., default: `false`\n\n- `\"rust.wait_to_build\"`:\n\n  Time in milliseconds between receiving a change notification and starting build., default: `1500`\n\n- `\"rust.show_warnings\"`:\n\n  Show warnings., default: `true`\n\n- `\"rust.crate_blacklist\"`:\n\n  Overrides the default list of packages for which analysis is skipped.\n\n  Available since RLS 1.38, default: `[\"cocoa\",\"gleam\",\"glium\",\"idna\",\"libc\",\"openssl\",\"rustc_serialize\",\"serde\",\"serde_json\",\"typenum\",\"unicode_normalization\",\"unicode_segmentation\",\"winapi\"]`\n\n- `\"rust.build_on_save\"`:\n\n  Only index the project when a file is saved and not on change., default: `false`\n\n- `\"rust.features\"`:\n\n  A list of Cargo features to enable., default: `[]`\n\n- `\"rust.all_features\"`:\n\n  Enable all Cargo features., default: `false`\n\n- `\"rust.no_default_features\"`:\n\n  Do not enable default Cargo features., default: `false`\n\n- `\"rust.racer_completion\"`:\n\n  Enables code completion using racer., default: `true`\n\n- `\"rust.clippy_preference\"`:\n\n  Controls eagerness of [clippy] diagnostics when available. Valid values are (case-insensitive):\n\n  - `\"off\"`: Disable clippy lints.\n  - `\"opt-in\"`: Clippy lints are shown when crates specify `#![warn(clippy)]`.\n  - `\"on\"`: Clippy lints enabled for all crates in workspace.\n    You need to install clippy via rustup if you haven't already., default: `\"opt-in\"`\n\n  Valid options: `[\"on\",\"opt-in\",\"off\"]`\n\n- `\"rust.jobs\"`:\n\n  Number of Cargo jobs to be run in parallel., default: `null`\n\n- `\"rust.all_targets\"`:\n\n  Checks the project as if you were running cargo check `--all-target`s (I.e., check all targets and integration tests too)., default: `true`\n\n- `\"rust.target_dir\"`:\n\n  When specified, it places the generated analysis files at the specified target directory. By default it is placed target/rls directory., default: `null`\n\n- `\"rust.rustfmt_path\"`:\n\n  When specified, RLS will use the Rustfmt pointed at the path instead of the bundled one, default: `null`\n\n- `\"rust.build_command\"`:\n\n  **EXPERIMENTAL** (requires `unstable_features`)\n\n  If set, executes a given program responsible for rebuilding save-analysis to be loaded by the RLS. The program given should output a list of resulting .json files on stdout.\n  Implies `rust.build_on_save`: true., default: `null`\n\n- `\"rust.full_docs\"`:\n\n  Instructs cargo to enable full documentation extraction during save-analysis while building the crate., default: `null`\n\n- `\"rust.show_hover_context\"`:\n\n  Show additional context in hover tooltips when available. This is often the type local variable declaration., default: `true`\n\n## Features\n\n### Snippets\n\nSnippets are code templates which expand into common boilerplate. Intellisense\nincludes snippet names as options when you type; select one by confirm the\ncompletion.\nYou can move to the next 'hole' in the template by pressing '\u003cC-j\u003e' (by default).\nWe provide the following snippets:\n\n- `for` - a for loop\n- `unimplemented`\n- `unreachable`\n- `println`\n- `assert` and `assert_eq`\n- `macro_rules` - declare a macro\n- `if let Option` - an `if let` statement for executing code only in the `Some`\n  case.\n- `spawn` - spawn a thread\n- `extern crate` - insert an `extern crate` statement\n\nThis extension is deliberately conservative about snippets and doesn't include\ntoo many. If you want more, check out\n[Trusty Rusty Snippets](https://marketplace.visualstudio.com/items?itemName=polypus74.trusty-rusty-snippets).\n\n## Format on save\n\nTo enable formatting on save, open `coc-settings.json` by `:CocConfig`, then add\n`\"rust\"` to `coc.preferences.formatOnSaveFiletypes` field.\n\n## Requirements\n\n- Unless you have `\"rust-client.disableRustup\": true`, install\n  [Rustup](https://www.rustup.rs/) required.\n- A Rust toolchain (the extension will configure this for you, with\n  permission),\n- RLS (currently `rls-preview`), `rust-src`, and `rust-analysis` components (the\n  extension will install these for you, with permission).\n\n## Implementation\n\nThis extension almost exclusively uses the RLS for its feature support (snippets\nare provided client-side). The RLS uses the Rust compiler (rustc) to get data\nabout Rust programs. It uses Cargo to manage building. Both Cargo and rustc are\nrun in-process by the RLS. Formatting and code completion are provided by\nrustfmt and Racer, again both of these are run in-process by the RLS.\n\n## LICENSE\n\nMIT\n\n[clippy]: https://github.com/rust-lang/rust-clippy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoclide%2Fcoc-rls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneoclide%2Fcoc-rls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneoclide%2Fcoc-rls/lists"}