From: Jeremy Kolb Date: Fri, 20 Dec 2019 23:57:31 +0000 (-0500) Subject: Use SelectionRange from LSP 3.15 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=429199d4815a001e1b60089b4f34c3ae6b7204f9;p=rust.git Use SelectionRange from LSP 3.15 --- diff --git a/Cargo.lock b/Cargo.lock index 3f2cbc8ab0b..c29ce324e89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -620,7 +620,7 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.63.1" +version = "0.65.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1049,7 +1049,7 @@ dependencies = [ "jod-thread 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "lsp-server 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lsp-types 0.63.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lsp-types 0.65.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "ra_ide 0.1.0", "ra_prof 0.1.0", @@ -1841,7 +1841,7 @@ dependencies = [ "checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum lsp-server 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ba36405bd742139ab79c246ca5adb7fde2fe1a0f495e2c8e2f607b607dedb12" -"checksum lsp-types 0.63.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70090cea3cd5db0aa923575e03874b33da90c4d0fe1eaf63fa51b8925a78ef03" +"checksum lsp-types 0.65.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fe9e427e63e6172699737b47f1044bcade7046e2404d59ebd90c459da47cd2b" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index e29b688fdb2..e826c10ef03 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -14,7 +14,7 @@ serde_json = "1.0.34" serde = { version = "1.0.83", features = ["derive"] } crossbeam-channel = "0.4" log = "0.4.3" -lsp-types = { version = "0.63.1", features = ["proposed"] } +lsp-types = { version = "0.65.0", features = ["proposed"] } rustc-hash = "1.0" parking_lot = "0.10.0" jod-thread = "0.1.0" diff --git a/crates/ra_lsp_server/src/caps.rs b/crates/ra_lsp_server/src/caps.rs index e0bb756666e..d812ff7ca2a 100644 --- a/crates/ra_lsp_server/src/caps.rs +++ b/crates/ra_lsp_server/src/caps.rs @@ -2,10 +2,11 @@ use lsp_types::{ CodeActionProviderCapability, CodeLensOptions, CompletionOptions, - DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, GenericCapability, - ImplementationProviderCapability, RenameOptions, RenameProviderCapability, ServerCapabilities, - SignatureHelpOptions, TextDocumentSyncCapability, TextDocumentSyncKind, - TextDocumentSyncOptions, TypeDefinitionProviderCapability, WorkDoneProgressOptions, + DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, + ImplementationProviderCapability, RenameOptions, RenameProviderCapability, + SelectionRangeProviderCapability, ServerCapabilities, SignatureHelpOptions, + TextDocumentSyncCapability, TextDocumentSyncKind, TextDocumentSyncOptions, + TypeDefinitionProviderCapability, WorkDoneProgressOptions, }; pub fn server_capabilities() -> ServerCapabilities { @@ -44,7 +45,7 @@ pub fn server_capabilities() -> ServerCapabilities { first_trigger_character: "=".to_string(), more_trigger_character: Some(vec![".".to_string(), ">".to_string()]), }), - selection_range_provider: Some(GenericCapability::default()), + selection_range_provider: Some(SelectionRangeProviderCapability::Simple(true)), folding_range_provider: Some(FoldingRangeProviderCapability::Simple(true)), rename_provider: Some(RenameProviderCapability::Options(RenameOptions { prepare_provider: Some(true), diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index 39361b7e8fd..2a22b655ce1 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs @@ -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 {} @@ -67,28 +68,6 @@ pub struct ExpandMacroParams { pub position: Option, } -pub enum SelectionRangeRequest {} - -impl Request for SelectionRangeRequest { - type Params = SelectionRangeParams; - type Result = Vec; - const METHOD: &'static str = "textDocument/selectionRange"; -} - -#[derive(Deserialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct SelectionRangeParams { - pub text_document: TextDocumentIdentifier, - pub positions: Vec, -} - -#[derive(Serialize, Debug)] -#[serde(rename_all = "camelCase")] -pub struct SelectionRange { - pub range: Range, - pub parent: Option>, -} - pub enum FindMatchingBrace {} impl Request for FindMatchingBrace {