Questions tagged [rust-analyzer]

100 questions
3
votes
1 answer

Is there any way to track the monomorphization process of generics?

I find it is untrackable by just reading the plain source code, when the generic relationship is convoluted. Is there any way to disclose the compiler's instantiation trajectory of a particular generic struct or function? Elaborated: Thanks for…
Tim
  • 99
  • 1
  • 5
3
votes
1 answer

rust-analyzer on neovim not working on macOS

I am using NeoVim with NvChad default configs on a M1 mac. Trying to edit a .rs file. Neovim lsp shows snippets but no error or autocompletion. What I did I have installed rust-analyzer with Mason and configured #…
3
votes
2 answers

How do I get Codebook to run Rust (installed by conda) in VS Code

I have installed Anaconda 3 and VS Code on Windows 10. I am interested in running Rust in a notebook, and I found CodeBook which seemed to fit the bill. I installed Rust using conda in an environment conda create -n rust_env -c conda-forge rust, and…
Diomedea
  • 193
  • 1
  • 9
3
votes
3 answers

rust-analyzer failed to load workspace: "cargo" "--version" failed: program not found

I have Rust installed using WSL2 Ubuntu I have alredy ran basic commands like hello world in rust so cargo is working. I wanted to download the rust-analyzer in VSCODE but I keep getting that error message from the title: rust-analyzer failed to…
3
votes
2 answers

proc macro not found

My main function is decorated with two proc macros like this: #[paw::main] #[tokio::main] pub async fn main(args: Args) -> Result<()> This compiles and runs as I expect it but VS code's rust-analyzer gives me this error on both lines of attribute…
Thorkil Værge
  • 2,727
  • 5
  • 32
  • 48
3
votes
1 answer

Why do I see ": String" added onto let statements in VSCode?

When I type this in VSCode: let mut guess = String::new(); I see it changed to: let mut guess: String = String::new(); Why is this happening?
user18209476
3
votes
1 answer

How to run Rust Analyzer directly from terminal?

I'm trying to integrate Rust Analyzer with a browser based editor. My first step is to run Rust Analyzer directly from a terminal and send requests via stdio. $ rust-analyzer >…
Agus Putra Dana
  • 669
  • 1
  • 6
  • 14
3
votes
1 answer

How to navigate to Rust sources in VSCode?

I have code something like this: #[derive(Debug)] struct Rectangle { width: u32, height: u32, } ... and I'm want to dive into source of Debug. In IntelliJ IDEA I'm put cursor on Debug and pressing cmd + b navigates me to Rust sources. In…
vaan
  • 350
  • 1
  • 8
  • 21
3
votes
2 answers

How to hide keywords from rust-analyzer autocomplete?

I'm using rust-analyzer 0.2.654 (latest) on VS Code 1.57.1 (also latest) on Windows 10. The autocomplete displays all keywords, as shown below: How can I hide the keywords, displaying only the actual struct members?
rodrigocfd
  • 6,450
  • 6
  • 34
  • 68
3
votes
0 answers

Why does Rust Analyser disagree with the compiler?

I'm using the latest stable version: rustc 1.46.0 (04488afe3 2020-08-24). Rust Analyser needs the import: use chrono::offset::TimeZone; in order to accept the expression: Utc.ymd(1970, 1, 1).and_hms_milli(0, 0, 0, 200) (It highlights the .ymd as…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
2
votes
0 answers

Can I tell the rust-analyzer to use the WSL rust installation?

https://www.rust-lang.org/tools/install states that one can install Rust using WSL, which works fine. However, it seems like the rust-analyzer addon for VSCode can only leverage the rust installation of the host system by default as it cannot find…
lema
  • 344
  • 7
  • 15
2
votes
1 answer

NeoVim shows diagnostic for `std` and other crates outside my current workspace

I use NeoVim with LSP Zero plugin + Rust analyzer for rust programming. When I jump to a definition in some external crate (including std) Nvim's diagnostic starts to show me all the errors from that crate. For example, if I just create new project…
Dmitry
  • 1,426
  • 5
  • 11
2
votes
1 answer

how to make rust-analyzer recognize sub-folders

rust-analyzer recognizes examples folder , and what I want is to recognize it, sub-folders like 'examples/borrowship/' so I can collect useful snippets and study under in one project, is there any way ?
atari_61
  • 91
  • 4
2
votes
1 answer

How do I hide the "Run | Debug" above main() text in vscode?

I normally run my application from the terminal directly so this text just adds a bit of noise. Any idea how to remove it?
David Alsh
  • 6,747
  • 6
  • 34
  • 60
2
votes
1 answer

Vscode rust-analyser plugin, on macOS; failing to load workspace due to permission denied

Goal I'm trying to setup Visual Studio Code(vscode) on macOS for rust development. I had my setup working, using the official rust extension, but it wasn't always consistent. I saw that the rust-analyzer extension could provide a better…