Questions tagged [rust-analyzer]

100 questions
1
vote
1 answer

Debug bench function in bench target rise "Multiple compilation artifacts are not supported." error

env: Use VScode + RA with nightly Rust toolchain. e.g. bench.rs file #![feature(test)] extern crate test; use test::*; #[bench] fn demo(b:& Bencher){ ... } When click Debug lens trigger "Multiple compilation artifacts are not supported"…
Larry
  • 155
  • 7
1
vote
1 answer

rust-analyzer with optional feature

I have vscode set up with the rust-analyzer plugin and it works in most cases. I have just added an optional feature but I cannot get vscode/rust-analyzer to parse the code, instead it always shows: code is inactive due to #[cfg] directives: std is…
Michael
  • 507
  • 4
  • 11
1
vote
0 answers

How to share the LSP for all instances of neovim?

I'm using neovim as main text editor, and rust-analyzer as LSP for rust file type. All works fine, but each instance of neovim starts its own instance of LSP, and this takes a lot of resources. So the question is, what is the way to make once…
al3x
  • 589
  • 1
  • 4
  • 16
1
vote
1 answer

Why does `rust-analyzer.cargo.features` not change the features for the save check (VSCode Extension)?

I'm working on a rust project and you have to pick some features to decide the linear programming module to get the project to compile. Normally, I can run check with cargo check --features lp_coincbc,blas_openblas-system and everything works fine.…
iHowell
  • 2,263
  • 1
  • 25
  • 49
1
vote
1 answer

Why does vscode's "Run Doctest" helper filter all of my crate's Doctests?

Expected Behavior: Clicking "Run doctest" in vscode should execute one test from doctest snippets. Terminal output SHOULD say ("1 passed;" or "1 failed;"), and "1 filtered out;". Actual Behavior: Clicking "Run doctest" in vscode executes 0 tests,…
1
vote
1 answer

NetworkBehaviour unsatisfied trait bounds

I'm a beginner at Rust and I've been following this tutorial on creating a simple blockchain using Rust. chain.rs use byteorder::{BigEndian, ReadBytesExt}; use chrono::offset::Utc; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; use…
Zeddling
  • 13
  • 4
1
vote
1 answer

How to select the code prompted by nvim ,and jump to the prompted document

I'am using the coc-rust-anaylzer plugin Now the problem is I can only see the a prompt, but I don't know how to select the options he gives me, I have tried enter, which only breaks the line and doesn't select it,I have also tried the tab key, and…
Cyberlin
  • 195
  • 5
1
vote
0 answers

Rust-analyzer web-sys document is "unknown"

Why is the document object unknown. In fact, everything, even the window.document call is not linted. Linting is quite important for me to lean a new programming language/library. lib.rs use wasm_bindgen::prelude::*; #[wasm_bindgen(start)] pub fn…
Elias
  • 3,592
  • 2
  • 19
  • 42
1
vote
2 answers

Cannot activate rust-analyzer: bootstrap error

Starting 2020-12-09, VSCode's Rust Analyzer extension no longer loads for me. On launch, it prints out this error message: Cannot activate rust-analyzer: bootstrap error. See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically).…
IInspectable
  • 46,945
  • 8
  • 85
  • 181
1
vote
0 answers

How to hide non-static methods in struct suggestions provided by rust-analyzer?

I'm using rust-analyzer 0.3.193-nightly with VSCode 1.45.1, Windows 10 x64. On a struct, when I type ::, I'd like to see the static methods only. Non-static methods are also showing up in suggestion list. I the example below, I would not like to see…
rodrigocfd
  • 6,450
  • 6
  • 34
  • 68
0
votes
0 answers

command terminal in vscode can't use rustc

I am very new to rust, and I was trying to create a simple hello world program. When in tried to run the program in VSCode using rustc main.rs, I got the error "'rustc' is not recognized as an internal or external command,operable program or batch…
all_caps
  • 29
  • 4
0
votes
1 answer

rust-analyzer Failed to discover workspace when using VS Code with more than 1 project in the workspace

Using the latest Rust Analyzer, I have a workspace that contains more than 1 project, but it keeps printing errors as shown in the attached image. test1: Cargo.toml [package] name = "test1" version = "0.1.0" edition = "2021" # See more keys and…
user63898
  • 29,839
  • 85
  • 272
  • 514
0
votes
0 answers

rust-analyzer error and warning when cargo run is working fine

I have a package that contains both a binary crate and a library crate. The structure of the package looks like this . ├── Cargo.lock ├── Cargo.toml ├── src │   ├── bin │   │   └── bin.rs │   ├── lib.rs │   ├── foo │   │   ├── concrete.rs │   │  …
HashBr0wn
  • 387
  • 1
  • 11
0
votes
1 answer

cannot enable Semantic Highlighting when using Rust Analyzer for VS Code

I am testing whether it's working or not by following the instructions here. I do not see a "semantic token type" section in the inspector popup. Furthermore, if I change the color of a very obvious token type ("variable") to something unmistakable…
bzm3r
  • 3,113
  • 6
  • 34
  • 67
0
votes
1 answer

Rust-Analyzer crates not being recognized

I am working with a CLI application suite built in Rust. I currently configured Rust-Analyzer to help manage the project but I am getting errors across my suit on the crate imports of my sub applications.The rand, rusqlite, and regex crates are not…