Support cancellation requests (#18627)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run

This commit is contained in:
Micha Reiser 2025-06-12 22:08:42 +02:00 committed by GitHub
parent 1f27d53fd5
commit 015222900f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 1324 additions and 857 deletions

View file

@ -8,7 +8,7 @@ use lsp_types::{
Position, Range, TextDocumentContentChangeEvent, VersionedTextDocumentIdentifier,
};
use ruff_notebook::SourceValue;
use ruff_server::{ClientOptions, GlobalOptions, Workspace, Workspaces};
use ruff_server::{Client, ClientOptions, GlobalOptions, Workspace, Workspaces};
const SUPER_RESOLUTION_OVERVIEW_PATH: &str =
"./resources/test/fixtures/tensorflow_test_notebook.ipynb";
@ -28,8 +28,13 @@ fn super_resolution_overview() {
insta::assert_snapshot!("initial_notebook", notebook_source(&notebook));
let (main_loop_sender, main_loop_receiver) = crossbeam::channel::unbounded();
let (client_sender, client_receiver) = crossbeam::channel::unbounded();
let client = Client::new(main_loop_sender, client_sender);
let options = GlobalOptions::default();
let global = options.into_settings();
let global = options.into_settings(client.clone());
let mut session = ruff_server::Session::new(
&ClientCapabilities::default(),
@ -39,6 +44,7 @@ fn super_resolution_overview() {
Workspace::new(lsp_types::Url::from_file_path(file_path.parent().unwrap()).unwrap())
.with_options(ClientOptions::default()),
]),
&client,
)
.unwrap();
@ -307,6 +313,9 @@ fn super_resolution_overview() {
"changed_notebook",
notebook_source(snapshot.query().as_notebook().unwrap())
);
assert!(client_receiver.is_empty());
assert!(main_loop_receiver.is_empty());
}
fn notebook_source(notebook: &ruff_server::NotebookDocument) -> String {