rust-lang / rust-lang/rust-analyzer
ASCII color codes are displayed inline for for editors
@ShoyuVanilla is already working on this.
Since Oct 20, 2025.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
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 https://github.com/neovim/nvim-lspconfig/issues/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.rswith 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.