Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions crates/red_knot_server/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ pub(super) fn request<'a>(req: server::Request) -> Task<'a> {
let id = req.id.clone();

match req.method.as_str() {
request::DocumentDiagnosticRequestHandler::METHOD => {
background_request_task::<request::DocumentDiagnosticRequestHandler>(
req,
BackgroundSchedule::LatencySensitive,
)
request::DocumentDiagnosticRequestHandler::METHOD => background_request_task::<
request::DocumentDiagnosticRequestHandler,
>(
req, BackgroundSchedule::Worker
),
request::GotoTypeDefinitionRequestHandler::METHOD => background_request_task::<
request::GotoTypeDefinitionRequestHandler,
>(
req, BackgroundSchedule::Worker
),
request::HoverRequestHandler::METHOD => {
background_request_task::<request::HoverRequestHandler>(req, BackgroundSchedule::Worker)
}
request::GotoTypeDefinitionRequestHandler::METHOD => {
background_request_task::<request::GotoTypeDefinitionRequestHandler>(
req,
BackgroundSchedule::LatencySensitive,
)
}
request::HoverRequestHandler::METHOD => background_request_task::<
request::HoverRequestHandler,
>(req, BackgroundSchedule::LatencySensitive),

method => {
tracing::warn!("Received request {method} which does not have a handler");
Expand Down
3 changes: 2 additions & 1 deletion crates/red_knot_server/src/server/schedule/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ pub(in crate::server) enum BackgroundSchedule {
/// for formatting actions. This is a high priority thread.
Fmt,
/// The task should be run on the general high-priority background
/// thread.
/// thread. Reserved for actions caused by the user typing (e.g.syntax highlighting).
LatencySensitive,
/// The task should be run on a regular-priority background thread.
/// The default for any request that isn't in the critical path of the user typing.
#[default]
Worker,
}
Expand Down
12 changes: 4 additions & 8 deletions crates/ruff_server/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ pub(super) fn request<'a>(req: server::Request) -> Task<'a> {
let id = req.id.clone();

match req.method.as_str() {
request::CodeActions::METHOD => background_request_task::<request::CodeActions>(
req,
BackgroundSchedule::LatencySensitive,
),
request::CodeActions::METHOD => {
background_request_task::<request::CodeActions>(req, BackgroundSchedule::Worker)
}
request::CodeActionResolve::METHOD => {
background_request_task::<request::CodeActionResolve>(req, BackgroundSchedule::Worker)
}
request::DocumentDiagnostic::METHOD => {
background_request_task::<request::DocumentDiagnostic>(
req,
BackgroundSchedule::LatencySensitive,
)
background_request_task::<request::DocumentDiagnostic>(req, BackgroundSchedule::Worker)
}
request::ExecuteCommand::METHOD => local_request_task::<request::ExecuteCommand>(req),
request::Format::METHOD => {
Expand Down
4 changes: 3 additions & 1 deletion crates/ruff_server/src/server/schedule/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ pub(in crate::server) enum BackgroundSchedule {
/// for formatting actions. This is a high priority thread.
Fmt,
/// The task should be run on the general high-priority background
/// thread.
/// thread. Reserved for actions caused by the user typing (e.g.syntax highlighting).
#[expect(dead_code)]
LatencySensitive,
/// The task should be run on a regular-priority background thread.
/// The default for any request that isn't in the critical path of the user typing.
#[default]
Worker,
}
Expand Down
Loading