Skip to content

Commit 8e15b09

Browse files
committed
Don't run debug path in unit tests
1 parent c15704f commit 8e15b09

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

crates/ark/src/lsp/completions/sources/composite/search_path.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use libr::R_lsInternal;
1818
use libr::ENCLOS;
1919
use tower_lsp::lsp_types::CompletionItem;
2020

21-
use crate::interface::RMain;
2221
use crate::lsp::completions::completion_context::CompletionContext;
2322
use crate::lsp::completions::completion_item::completion_item_from_package;
2423
use crate::lsp::completions::completion_item::completion_item_from_symbol;
@@ -63,9 +62,13 @@ fn completions_from_search_path(
6362

6463
// If we're waiting for input in `read_console()` with a debugger
6564
// prompt, start from current environment
66-
if let Some(debug_env) = &RMain::get().debug_env {
67-
// Mem-Safety: Object protected by `RMain` for the duration of the `r_task()`
68-
env = debug_env.sexp;
65+
#[cfg(not(test))] // Unit tests do not have an `RMain`
66+
{
67+
use crate::interface::RMain;
68+
if let Some(debug_env) = &RMain::get().debug_env {
69+
// Mem-Safety: Object protected by `RMain` for the duration of the `r_task()`
70+
env = debug_env.sexp;
71+
}
6972
}
7073

7174
while env != R_EmptyEnv {

0 commit comments

Comments
 (0)