How to Enable Real-time/Streaming Output for Tests with rustaceanvim
using RustLsp("run")
?
#758
-
Hi everyone, I'm using Currently, when I'm on a test function (e.g., Interestingly, if I use What I'm trying to achieve: Steps I'm taking:
Example Code // Prints in real time!
fn main() {
println!("Hello, world!");
std::thread::sleep(std::time::Duration::from_secs(3));
println!("Goodbye, world!");
}
#[cfg(test)]
mod test {
// Does not print in real time!
#[test]
fn name() {
super::main();
}
} Example Codevim.env.LAZY_STDPATH = '.repro'
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()
require('lazy.minit').repro {
spec = {
{
'mrcjkb/rustaceanvim',
version = '^6',
init = function()
-- This did not help!
-- vim.g.rustaceanvim = { tools = { test_executor = 'background' } }
end,
lazy = false,
},
},
} Neovim version (nvim -v)v0.11.1 Operating system/versionFedora Linux 42 Output of :checkhealth rustaceanvim==============================================================================
rustaceanvim: require("rustaceanvim.health").check()
Checking for Lua dependencies ~
- ✅ OK optional dependency nvim-dap not installed. Needed for debugging features [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap)
Checking external dependencies ~
- ✅ OK rust-analyzer: found rust-analyzer 1.86.0
- ✅ OK Cargo: found cargo 1.86.0 (adf9b6ad1 2025-02-28)
- ✅ OK rustc: found rustc 1.86.0 (05f9846f8 2025-03-31) (Fedora 1.86.0-1.fc42)
Checking config ~
- ✅ OK No errors found in config.
Checking for conflicting plugins ~
- ✅ OK No conflicting plugins detected.
Checking for tree-sitter parser ~
- ✅ OK tree-sitter parser for Rust detected. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hey 👋 By default,
Or, in Lua: vim.cmd.RustLsp { "run", "--nocapture" } |
Beta Was this translation helpful? Give feedback.
Hey 👋
By default,
cargo test
captures stdout, to keep test output tidy. If you runcargo test
in a terminal, you'll observe the same behaviour.With the cargo CLI, you can disable this behaviour by passing
--nocapture
to the test executable:cargo test -- --nocapture
.With the
:RustLsp run
command, you can just append the flag:Or, in Lua: