-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Sometimes, the error shown in Vim (and apparently VS Code too) is printed with ASCII color codes showing in the string from rust_analyzer. It makes the error very hard to read. See neovim/nvim-lspconfig#2760.
It seems to me like rust-analyzer
does not properly distinguish between being executed in a terminal environment or not, and decide from that whether to print ASCII color codes or skip them.
In terminal:
In editor:
Steps to reproduce
- Create the following crate:
cargo new -q foo
cd foo
cargo add -q rocket@0.5.0-rc.3
cat <<EOF > src/main.rs
use rocket::UriDisplayPath;
fn main() {
println!("Hello, world!");
}
#[derive(UriDisplayPath)]
pub enum Foo {
Bar,
}
EOF
- Optionally run
cargo check
. - Open
src/main.rs
with Vim.
Other info
rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
Mason reports rust-analyzer 2023-08-07.
rustc version: (eg. output of rustc -V
)
$ rustc -V
rustc 1.71.1 (eb26296b5 2023-08-03)
relevant settings: (eg. client settings, or environment variables like CARGO
, RUSTC
, RUSTUP_HOME
or CARGO_HOME
)
Not sure, nothing I've set explicitly at least. I run NeoVim with rust-lang/rust.vim and rust_analyzer for lspconfig installed via Mason.