Remove nu-glob's dependency on nu-protocol (#15349)

# Description

This PR solves a circular dependency issue (`nu-test-support` needs
`nu-glob` which needs `nu-protocol` which needs `nu-test-support`). This
was done by making the glob functions that any type that implements
`Interruptible` to remove the dependency on `Signals`.

# After Submitting

Make `Paths.next()` a O(1) operation so that cancellation/interrupt
handling can be moved to the caller (e.g., by wrapping the `Paths`
iterator in a cancellation iterator).
This commit is contained in:
Ian Manske
2025-03-20 09:32:41 -07:00
committed by GitHub
parent b241e9edd5
commit dfba62da00
8 changed files with 81 additions and 59 deletions

View File

@ -9,6 +9,7 @@ use lsp_types::{
TextDocumentPositionParams, TextEdit, Uri, WorkspaceEdit, WorkspaceFolder,
};
use miette::{miette, IntoDiagnostic, Result};
use nu_glob::Uninterruptible;
use nu_protocol::{
engine::{EngineState, StateWorkingSet},
Span,
@ -42,7 +43,7 @@ fn find_nu_scripts_in_folder(folder_uri: &Uri) -> Result<nu_glob::Paths> {
return Err(miette!("\nworkspace folder does not exist."));
}
let pattern = format!("{}/**/*.nu", path.to_string_lossy());
nu_glob::glob(&pattern, None).into_diagnostic()
nu_glob::glob(&pattern, Uninterruptible).into_diagnostic()
}
impl LanguageServer {