]> git.lizzy.rs Git - rust.git/blobdiff - crates/ra_lsp_server/src/req.rs
Use SelectionRange from LSP 3.15
[rust.git] / crates / ra_lsp_server / src / req.rs
index dbc0e9624cbaf55f9fc11773c93756908f0a8248..2a22b655ce1b10ad223b1c4e338ceb40f1da3e73 100644 (file)
@@ -10,8 +10,9 @@
     DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions,
     DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse,
     FileSystemWatcher, Hover, InitializeResult, MessageType, PublishDiagnosticsParams,
-    ReferenceParams, Registration, RegistrationParams, ShowMessageParams, SignatureHelp,
-    TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams,
+    ReferenceParams, Registration, RegistrationParams, SelectionRange, SelectionRangeParams,
+    ShowMessageParams, SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit,
+    WorkspaceEdit, WorkspaceSymbolParams,
 };
 
 pub enum AnalyzerStatus {}
@@ -45,11 +46,18 @@ pub struct SyntaxTreeParams {
     pub range: Option<Range>,
 }
 
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct ExpandedMacro {
+    pub name: String,
+    pub expansion: String,
+}
+
 pub enum ExpandMacro {}
 
 impl Request for ExpandMacro {
     type Params = ExpandMacroParams;
-    type Result = Option<(String, String)>;
+    type Result = Option<ExpandedMacro>;
     const METHOD: &'static str = "rust-analyzer/expandMacro";
 }
 
@@ -60,28 +68,6 @@ pub struct ExpandMacroParams {
     pub position: Option<Position>,
 }
 
-pub enum SelectionRangeRequest {}
-
-impl Request for SelectionRangeRequest {
-    type Params = SelectionRangeParams;
-    type Result = Vec<SelectionRange>;
-    const METHOD: &'static str = "textDocument/selectionRange";
-}
-
-#[derive(Deserialize, Debug)]
-#[serde(rename_all = "camelCase")]
-pub struct SelectionRangeParams {
-    pub text_document: TextDocumentIdentifier,
-    pub positions: Vec<Position>,
-}
-
-#[derive(Serialize, Debug)]
-#[serde(rename_all = "camelCase")]
-pub struct SelectionRange {
-    pub range: Range,
-    pub parent: Option<Box<SelectionRange>>,
-}
-
 pub enum FindMatchingBrace {}
 
 impl Request for FindMatchingBrace {