Questions tagged [rust-analyzer]

100 questions
2
votes
0 answers

Type hinting is broken for non consuming iterator over `Vec`

In my VSCode IDE (rust + rust-analyzer), let v = vec![1, 2, 3]; for x in v.iter() { println!("{}", x); } the above codes can't show Auto-Type Hints correctly (while most other hints work well), but several weeks ago they did. The problems…
xc wang
  • 318
  • 1
  • 3
  • 14
2
votes
1 answer

Why are top level or-patterns not allowed in let bindings?

fn foo(ok: bool) -> Result { if ok { Ok(0) } else { Err(0) } } fn main() { let Ok(x) | Err(x) = foo(true); // rust-analyzer error: top-level or-patterns are not allowed in `let` bindings if let Ok(x) | Err(x) = foo(true) { //…
Wynell
  • 633
  • 1
  • 8
  • 15
2
votes
1 answer

Why are my variables duplicated and sometimes corrupted when debugging?

I have a very straightforward rust function which just simply wants to get the first value of the list that is passed into it. use std::fmt::Debug; use std::ops::Add; fn main() { fn calculate, const N: usize>(data_set:…
Gunty
  • 1,841
  • 1
  • 15
  • 27
2
votes
2 answers

Automatically convert all the identifiers in appropriate case

So for example, pub enum Format { Undefined, R4g4UnormPack8, R4g4b4a4UnormPack16, B4g4r4a4UnormPack16, R5g6b5UnormPack16, B5g6r5UnormPack16, R5G5B5A1_UNORM_PACK16, B5G5R5A1_UNORM_PACK16, A1R5G5B5_UNORM_PACK16, …
marknikky
  • 101
  • 1
  • 5
1
vote
2 answers

How can I disable problem underlines for unused variables with the Rust Analyzer VS Code extension and instead highlight it gray?

I am coding in Rust by using VS Code, but the variable that i'm not used shows a ugly wavy underline, i want to disable it and just make my unused variables being gray which seems like IntelliJ IDEA shows unused functions. VS Code: goland
Stop
  • 13
  • 2
1
vote
1 answer

how do temporarily turn of vs-code error highlighting

VS Code error hi-lighting can offer quite a bit of clutter during code edits with its squiggles and colorization. It is a useful horn but once the problem is noticed it can become a nuisance that even makes it difficult to perceive the text and fix…
George
  • 2,451
  • 27
  • 37
1
vote
3 answers

I have problems with (Mason) lsp server rust-analyzer

I am new to Neovim. I have install neovim v0.9 and copied lua configuration from kickstart.nvim. I have followed all the instructions as per TJ's youtube video too. Everything is working perfectly fine. Lsp is working for ts and lua. But Lsp…
ajihsan
  • 11
  • 2
1
vote
0 answers

How can I configure VSCode rust-analyzer Rust plugin to accept arguments for the shortcuts in the Editor body

I am getting started using VSCode withe the rust-analyzer plugin. I really like the ">Run" "shortcuts" that the plugin adds to all the functions and tests. How can I pass in command line arguments to these shortcuts ? I tried to edit the launch.json…
harijay
  • 11,303
  • 12
  • 38
  • 52
1
vote
0 answers

coc.vim failing with :checkhealth command

I'm trying to setup coc for nvim on my Windows os. I installed coc via vim-plug and have the coc.nvim config sourced in my main init.vim file. I recieve these messages when I open neovim and run :checkhealth coc: health#coc#check …
tre3iii
  • 11
  • 1
1
vote
3 answers

How to get the syntax highlighter (Rust) to highlight formatted strings correctly in VSCode?

For example, here I am expecting sum and FILENAME to be in different colors than the rest of the string literal: I am using VSCode with rust-analyzer v0.4.1395 (Pre-release). Seems like Markdown also has this problem: println!("this is a formatted…
1
vote
1 answer

VS code rust analyzer - no lint, autocomlete or hover

How to enable in VS Code rust-analyzer hints linting auto complete? here no contains function
Vikkes
  • 463
  • 4
  • 17
1
vote
1 answer

how to disable vs code toast feature

The toast notifications (popups) of VS Code is surprisingly annoying. These notifications are often redundant and cluttering as well as visually distracting. I know this has been asked before and wondering if there is anything new as of 2022.…
George
  • 2,451
  • 27
  • 37
1
vote
0 answers

Rust-analyzer in VSCode to substitute env variables in Cargo path imports

I have a Cargo workspace and want to use a WORKSPACE_HOME environment variable in the import path of local crates. For instance: in $WORKSPACE_HOME/services/api/Cargo.toml [dependencies] ... addrbook = { path = "${WORKSPACE_HOME}/pkg/addrbook"…
1
vote
1 answer

rust-analyzer can you autoinject variable type declarations?

Is it possible to run rust analyzer to not just display but outright inject variable types on variable declarations? Say in this case The linter is displaying the type, I would like it to inject the characters instead of just showing them.
Makogan
  • 8,208
  • 7
  • 44
  • 112
1
vote
0 answers

VS Code + Rust Analyzer: Insert ALL explicit types

Going off of Can VS Code + rust-analyzer insert inlay hints into the code?, is there way to insert all explicit types into my Rust code? This is especially useful if I'm pushing it to e.g. GitHub and would like other contributors to be able to view…
John C
  • 25
  • 6