]> 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 6b986bcc93894728b21d98cce5c41abd8d5553d1..2a22b655ce1b10ad223b1c4e338ceb40f1da3e73 100644 (file)
@@ -1,15 +1,18 @@
+//! FIXME: write short doc here
+
 use lsp_types::{Location, Position, Range, TextDocumentIdentifier, Url};
 use rustc_hash::FxHashMap;
 use serde::{Deserialize, Serialize};
-use url_serde;
 
 pub use lsp_types::{
     notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens,
     CodeLensParams, CompletionParams, CompletionResponse, DidChangeConfigurationParams,
-    DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse, Hover,
-    InitializeResult, MessageType, PublishDiagnosticsParams, ReferenceParams, ShowMessageParams,
-    SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit,
-    WorkspaceSymbolParams,
+    DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions,
+    DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse,
+    FileSystemWatcher, Hover, InitializeResult, MessageType, PublishDiagnosticsParams,
+    ReferenceParams, Registration, RegistrationParams, SelectionRange, SelectionRangeParams,
+    ShowMessageParams, SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit,
+    WorkspaceEdit, WorkspaceSymbolParams,
 };
 
 pub enum AnalyzerStatus {}
@@ -43,47 +46,26 @@ pub struct SyntaxTreeParams {
     pub range: Option<Range>,
 }
 
-pub enum ExtendSelection {}
-
-impl Request for ExtendSelection {
-    type Params = ExtendSelectionParams;
-    type Result = ExtendSelectionResult;
-    const METHOD: &'static str = "rust-analyzer/extendSelection";
-}
-
-#[derive(Deserialize, Debug)]
-#[serde(rename_all = "camelCase")]
-pub struct ExtendSelectionParams {
-    pub text_document: TextDocumentIdentifier,
-    pub selections: Vec<Range>,
-}
-
 #[derive(Serialize, Debug)]
 #[serde(rename_all = "camelCase")]
-pub struct ExtendSelectionResult {
-    pub selections: Vec<Range>,
+pub struct ExpandedMacro {
+    pub name: String,
+    pub expansion: String,
 }
 
-pub enum SelectionRangeRequest {}
+pub enum ExpandMacro {}
 
-impl Request for SelectionRangeRequest {
-    type Params = SelectionRangeParams;
-    type Result = Vec<SelectionRange>;
-    const METHOD: &'static str = "textDocument/selectionRange";
+impl Request for ExpandMacro {
+    type Params = ExpandMacroParams;
+    type Result = Option<ExpandedMacro>;
+    const METHOD: &'static str = "rust-analyzer/expandMacro";
 }
 
 #[derive(Deserialize, Debug)]
 #[serde(rename_all = "camelCase")]
-pub struct SelectionRangeParams {
+pub struct ExpandMacroParams {
     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 position: Option<Position>,
 }
 
 pub enum FindMatchingBrace {}
@@ -119,7 +101,6 @@ impl Notification for PublishDecorations {
 #[derive(Serialize, Debug)]
 #[serde(rename_all = "camelCase")]
 pub struct PublishDecorationsParams {
-    #[serde(with = "url_serde")]
     pub uri: Url,
     pub decorations: Vec<Decoration>,
 }