aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorJeremy Kolb <[email protected]>2019-12-20 23:57:31 +0000
committerJeremy Kolb <[email protected]>2019-12-20 23:57:31 +0000
commit429199d4815a001e1b60089b4f34c3ae6b7204f9 (patch)
treed2294d4efb585ba54d383a48e50166e93fdbd09e /crates/ra_lsp_server/src
parent6eab968c601637361e8fbd1ee93ded1b0d967bee (diff)
Use SelectionRange from LSP 3.15
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/caps.rs11
-rw-r--r--crates/ra_lsp_server/src/req.rs27
2 files changed, 9 insertions, 29 deletions
diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs
index e0bb75666..d812ff7ca 100644
--- a/crates/ra_lsp_server/src/caps.rs
+++ b/crates/ra_lsp_server/src/caps.rs
@@ -2,10 +2,11 @@
2 2
3use lsp_types::{ 3use lsp_types::{
4 CodeActionProviderCapability, CodeLensOptions, CompletionOptions, 4 CodeActionProviderCapability, CodeLensOptions, CompletionOptions,
5 DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability, 5 DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability,
6 ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities, 6 ImplementationProviderCapability, RenameOptions, RenameProviderCapability,
7 SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, 7 SelectionRangeProviderCapability, ServerCapabilities, SignatureHelpOptions,
8 TextDocumentSyncOptions, TypeDefinitionProviderCapability, WorkDoneProgressOptions, 8 TextDocumentSyncCapability, TextDocumentSyncKind, TextDocumentSyncOptions,
9 TypeDefinitionProviderCapability, WorkDoneProgressOptions,
9}; 10};
10 11
11pub fn server_capabilities() -> ServerCapabilities { 12pub fn server_capabilities() -> ServerCapabilities {
@@ -44,7 +45,7 @@ pub fn server_capabilities() -> ServerCapabilities {
44 first_trigger_character: "=".to_string(), 45 first_trigger_character: "=".to_string(),
45 more_trigger_character: Some(vec![".".to_string(), ">".to_string()]), 46 more_trigger_character: Some(vec![".".to_string(), ">".to_string()]),
46 }), 47 }),
47 selection_range_provider: Some(GenericCapability::default()), 48 selection_range_provider: Some(SelectionRangeProviderCapability::Simple(true)),
48 folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)), 49 folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)),
49 rename_provider: Some(RenameProviderCapability::Options(RenameOptions { 50 rename_provider: Some(RenameProviderCapability::Options(RenameOptions {
50 prepare_provider: Some(true), 51 prepare_provider: Some(true),
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs
index 39361b7e8..2a22b655c 100644
--- a/crates/ra_lsp_server/src/req.rs
+++ b/crates/ra_lsp_server/src/req.rs
@@ -10,8 +10,9 @@ pub use lsp_types::{
10 DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions, 10 DidChangeWatchedFilesParams, DidChangeWatchedFilesRegistrationOptions,
11 DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse, 11 DocumentOnTypeFormattingParams, DocumentSymbolParams, DocumentSymbolResponse,
12 FileSystemWatcher, Hover, InitializeResult, MessageType, PublishDiagnosticsParams, 12 FileSystemWatcher, Hover, InitializeResult, MessageType, PublishDiagnosticsParams,
13 ReferenceParams, Registration, RegistrationParams, ShowMessageParams, SignatureHelp, 13 ReferenceParams, Registration, RegistrationParams, SelectionRange, SelectionRangeParams,
14 TextDocumentEdit, TextDocumentPositionParams, TextEdit, WorkspaceEdit, WorkspaceSymbolParams, 14 ShowMessageParams, SignatureHelp, TextDocumentEdit, TextDocumentPositionParams, TextEdit,
15 WorkspaceEdit, WorkspaceSymbolParams,
15}; 16};
16 17
17pub enum AnalyzerStatus {} 18pub enum AnalyzerStatus {}
@@ -67,28 +68,6 @@ pub struct ExpandMacroParams {
67 pub position: Option<Position>, 68 pub position: Option<Position>,
68} 69}
69 70
70pub enum SelectionRangeRequest {}
71
72impl Request for SelectionRangeRequest {
73 type Params = SelectionRangeParams;
74 type Result = Vec<SelectionRange>;
75 const METHOD: &'static str = "textDocument/selectionRange";
76}
77
78#[derive(Deserialize, Debug)]
79#[serde(rename_all = "camelCase")]
80pub struct SelectionRangeParams {
81 pub text_document: TextDocumentIdentifier,
82 pub positions: Vec<Position>,
83}
84
85#[derive(Serialize, Debug)]
86#[serde(rename_all = "camelCase")]
87pub struct SelectionRange {
88 pub range: Range,
89 pub parent: Option<Box<SelectionRange>>,
90}
91
92pub enum FindMatchingBrace {} 71pub enum FindMatchingBrace {}
93 72
94impl Request for FindMatchingBrace { 73impl Request for FindMatchingBrace {