Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement hover menu support for ruff-server; Issue #10595 #11096

Merged
merged 10 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
79 changes: 40 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/ruff_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
tracing = { workspace = true }
walkdir = { workspace = true }
regex = { workspace = true }

[dev-dependencies]
insta = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions crates/ruff_server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ impl Server {
},
},
)),
hover_provider: Some(types::HoverProviderCapability::Simple(true)),
text_document_sync: Some(TextDocumentSyncCapability::Options(
TextDocumentSyncOptions {
open_close: Some(true),
Expand Down
3 changes: 3 additions & 0 deletions crates/ruff_server/src/server/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ pub(super) fn request<'a>(req: server::Request) -> Task<'a> {
request::FormatRange::METHOD => {
background_request_task::<request::FormatRange>(req, BackgroundSchedule::Fmt)
}
request::Hover::METHOD => {
background_request_task::<request::Hover>(req, BackgroundSchedule::Worker)
}
method => {
tracing::warn!("Received request {method} which does not have a handler");
return Task::nothing();
Expand Down
2 changes: 2 additions & 0 deletions crates/ruff_server/src/server/api/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod diagnostic;
mod execute_command;
mod format;
mod format_range;
mod hover;

use super::{
define_document_url,
Expand All @@ -15,5 +16,6 @@ pub(super) use diagnostic::DocumentDiagnostic;
pub(super) use execute_command::ExecuteCommand;
pub(super) use format::Format;
pub(super) use format_range::FormatRange;
pub(super) use hover::Hover;

type FormatResponse = Option<Vec<lsp_types::TextEdit>>;
Loading
Loading