use lsp_types::request::Request;
use lsp_types::{
- notification::Notification, CodeActionKind, Position, Range, TextDocumentIdentifier,
+ notification::Notification, CodeActionKind, PartialResultParams, Position, Range,
+ TextDocumentIdentifier, WorkDoneProgressParams,
};
use serde::{Deserialize, Serialize};
const METHOD: &'static str = "rust-analyzer/memoryUsage";
}
+pub enum ShuffleCrateGraph {}
+
+impl Request for ShuffleCrateGraph {
+ type Params = ();
+ type Result = ();
+ const METHOD: &'static str = "rust-analyzer/shuffleCrateGraph";
+}
+
pub enum ReloadWorkspace {}
impl Request for ReloadWorkspace {
const METHOD: &'static str = "rust-analyzer/viewHir";
}
+#[derive(Deserialize, Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct ViewCrateGraphParams {
+ /// Include *all* crates, not just crates in the workspace.
+ pub full: bool,
+}
+
+pub enum ViewCrateGraph {}
+
+impl Request for ViewCrateGraph {
+ type Params = ViewCrateGraphParams;
+ type Result = String;
+ const METHOD: &'static str = "rust-analyzer/viewCrateGraph";
+}
+
+#[derive(Deserialize, Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct ViewItemTreeParams {
+ pub text_document: TextDocumentIdentifier,
+}
+
+pub enum ViewItemTree {}
+
+impl Request for ViewItemTree {
+ type Params = ViewItemTreeParams;
+ type Result = String;
+ const METHOD: &'static str = "rust-analyzer/viewItemTree";
+}
+
pub enum ExpandMacro {}
impl Request for ExpandMacro {
pub enum HoverRequest {}
impl Request for HoverRequest {
- type Params = lsp_types::HoverParams;
+ type Params = HoverParams;
type Result = Option<Hover>;
const METHOD: &'static str = "textDocument/hover";
}
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct HoverParams {
+ pub text_document: TextDocumentIdentifier,
+ pub position: PositionOrRange,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum PositionOrRange {
+ Position(lsp_types::Position),
+ Range(lsp_types::Range),
+}
+
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
pub struct Hover {
#[serde(flatten)]
Up,
Down,
}
+
+#[derive(Debug)]
+pub enum WorkspaceSymbol {}
+
+impl Request for WorkspaceSymbol {
+ type Params = WorkspaceSymbolParams;
+ type Result = Option<Vec<lsp_types::SymbolInformation>>;
+ const METHOD: &'static str = "workspace/symbol";
+}
+
+#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct WorkspaceSymbolParams {
+ #[serde(flatten)]
+ pub partial_result_params: PartialResultParams,
+
+ #[serde(flatten)]
+ pub work_done_progress_params: WorkDoneProgressParams,
+
+ /// A non-empty query string
+ pub query: String,
+
+ pub search_scope: Option<WorkspaceSymbolSearchScope>,
+
+ pub search_kind: Option<WorkspaceSymbolSearchKind>,
+}
+
+#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub enum WorkspaceSymbolSearchScope {
+ Workspace,
+ WorkspaceAndDependencies,
+}
+
+#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub enum WorkspaceSymbolSearchKind {
+ OnlyTypes,
+ AllSymbols,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CompletionResolveData {
+ pub position: lsp_types::TextDocumentPositionParams,
+ pub imports: Vec<CompletionImport>,
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+pub struct CompletionImport {
+ pub full_import_path: String,
+ pub imported_name: String,
+}
+
+#[derive(Debug, Deserialize, Default)]
+pub struct ClientCommandOptions {
+ pub commands: Vec<String>,
+}