Add hover actions as LSP extension
This commit is contained in:
@@ -260,3 +260,37 @@ pub struct SnippetTextEdit {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub insert_text_format: Option<lsp_types::InsertTextFormat>,
|
||||
}
|
||||
|
||||
pub enum HoverRequest {}
|
||||
|
||||
impl Request for HoverRequest {
|
||||
type Params = lsp_types::HoverParams;
|
||||
type Result = Option<Hover>;
|
||||
const METHOD: &'static str = "textDocument/hover";
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
|
||||
pub struct Hover {
|
||||
pub contents: lsp_types::HoverContents,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub range: Option<Range>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub actions: Option<Vec<CommandLinkGroup>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Default, Deserialize, Serialize)]
|
||||
pub struct CommandLinkGroup {
|
||||
pub title: Option<String>,
|
||||
pub commands: Vec<CommandLink>,
|
||||
}
|
||||
|
||||
// LSP v3.15 Command does not have a `tooltip` field, vscode supports one.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Default, Deserialize, Serialize)]
|
||||
pub struct CommandLink {
|
||||
pub title: String,
|
||||
pub command: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tooltip: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub arguments: Option<Vec<serde_json::Value>>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user