<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary Add support for hover menu to ruff_server, as requested in [10595](https://github.com/astral-sh/ruff/issues/10595). Majority of new code is in hover.rs. I reused the regex from ruff-lsp's implementation. Also reused the format_rule_text function from ruff/src/commands/rule.rs Added capability registration in server.rs, and added the handler to api.rs. ## Test Plan Tested in NVIM v0.10.0-dev-2582+g2a8cef6bd, configured with lspconfig using the default options (other than cmd pointing to my test build, with options "server" and "--preview"). OS: Ubuntu 24.04, kernel 6.8.0-22. --------- Co-authored-by: Jane Lewis <me@jane.engineering>
22 lines
596 B
Rust
22 lines
596 B
Rust
mod code_action;
|
|
mod code_action_resolve;
|
|
mod diagnostic;
|
|
mod execute_command;
|
|
mod format;
|
|
mod format_range;
|
|
mod hover;
|
|
|
|
use super::{
|
|
define_document_url,
|
|
traits::{BackgroundDocumentRequestHandler, RequestHandler, SyncRequestHandler},
|
|
};
|
|
pub(super) use code_action::CodeActions;
|
|
pub(super) use code_action_resolve::CodeActionResolve;
|
|
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>>;
|