-
Neovim version (nvim -v)v0.9.5 Operating system/version6.7.4-arch1-1 Output of :checkhealth rustaceanvim==============================================================================
rustaceanvim: require("rustaceanvim.health").check()
Checking for Lua dependencies ~
- OK [mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap) installed.
Checking external dependencies ~
- OK rust-analyzer: found rust-analyzer 1.76.0 (07dca48 2024-02-04)
- OK Cargo: found cargo 1.76.0 (c84b36747 2024-01-18)
- OK rustc: found rustc 1.76.0 (07dca489a 2024-02-04)
- OK debug adapter: found codelldb
Checking config ~
- OK No errors found in config.
Checking for conflicting plugins ~
- OK No conflicting plugins detected.
Checking for tree-sitter parser ~
- WARNING No tree-sitter parser for Rust detected. Required by 'Rustc unpretty' command. How to reproduce the issue**Have codelldb or lldb installed. Arch - yay -S codelldb
//setup for minimal.lua
export NVIM_DATA_MINIMAL=$(mktemp -d)
export NVIM_APP_NAME="nvim-ht-minimal"
//create home directory with workspaces
mkdir bug_repo
cd bug_repo
touch minimal.lua
**copy paste minimal.lua
touch Cargo.toml
nvim Cargo.toml
"""
[workspace]
members = [
"adder",
"add_one",
]
"""
//create workspaces
cargo new add_one --lib
cargo new adder
//create testing file to read from
touch add_one/src/tester.txt
nvim add_one/tester.txt
"""
69
"""
//create problem file for debugger that reads in tester.txt in the test
nvim -u minimal.lua add_one/src/lib.rs
"""
use std::fs::File;
pub fn get_file() -> File {
let f = File::open("tester.txt").unwrap();
println!("Set breakpoint here");
f
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_get_file() {
//make a proper assertion
let _file = get_file();
assert_eq!(4, 4);
}
}
"""
//Run the debugger and tester
:RustLsp debuggables (then select option 2)
**This fails because it can't find "tester.txt"
Incongruent cargo workspace with --
:RustLsp testables (then select option 2)
**This passes because it can find tester.txt Expected behaviourThe debuggables executable to run in the library workspace add_one/ This is congruent with Actual behaviourError message called The debug executable should look for the "tester.txt" file in the add_one/ library folder. Instead it looks for it in the top level folder The minimal config used to reproduce this issue.-- Minimal nvim config with lazy
-- Assumes a directory in $NVIM_DATA_MINIMAL
-- Start with
--
-- export NVIM_DATA_MINIMAL=$(mktemp -d)
-- export NVIM_APP_NAME="nvim-ht-minimal"
-- nvim -u minimal.lua
--
-- Then exit out of neovim and start again.
-- Ignore default config
local config_path = vim.fn.stdpath('config')
vim.opt.rtp:remove(config_path)
-- Ignore default plugins
local data_path = vim.fn.stdpath('data')
local pack_path = data_path .. '/site'
vim.opt.packpath:remove(pack_path)
-- bootstrap lazy.nvim
data_path = assert(os.getenv('NVIM_DATA_MINIMAL'), '$NVIM_DATA_MINIMAL environment variable not set!')
local lazypath = data_path .. '/lazy/lazy.nvim'
local uv = vim.uv
---@diagnostic disable-next-line: deprecated
or vim.loop
if not uv.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'[email protected]:folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
local lazy = require('lazy')
lazy.setup({
{
'mrcjkb/rustaceanvim',
version = '^4',
init = function()
-- Configure rustaceanvim here
vim.g.rustaceanvim = {}
end,
ft = { 'rust' },
},
-- Add any other plugins needed to reproduce the issue.
-- see https://github.com/folke/lazy.nvim#-lazynvim for details.
{
"mfussenegger/nvim-dap",
},
}, { root = data_path, state = data_path .. '/lazy-state.json', lockfile = data_path .. '/lazy-lock.json' }) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey 👋 rustaceanvim just runs the command with the arguments it receives from If you have test resources, I suggest you put your file in For example: let mut test_manifest_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_manifest_path.push("resources/test/tester.txt"); I've just tested this with one of the projects I work with, and it works just fine with |
Beta Was this translation helpful? Give feedback.
-
This works perfectly! Thank you for such a clear and fast response @mrcjkb :) |
Beta Was this translation helpful? Give feedback.
Hey 👋
rustaceanvim just runs the command with the arguments it receives from
rust-analyzer
, so there's nothing I can do here work around this issue.If you have test resources, I suggest you put your file in
resources/test
and use theCARGO_MANIFEST_DIR
environment variable.For example:
I've just tested this with one of the projects I work with, and it works just fine with
:RustLsp debuggables
.