diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-11 23:36:53 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-11 23:36:53 +0100 |
commit | 49fbd1b6251f98ce4d7cbe62ffebaa008868166b (patch) | |
tree | 2619a048bd3890277a135f8400b0cffc5a31b60e /crates | |
parent | 02efda91d0fa856f0a2d33e9370147123c06abe7 (diff) | |
parent | 8c81465d5b43cb17162d5cd00e9e45ae02b47cd7 (diff) |
Merge #5325
5325: Update lsp-types to account for new CodeActionKind structure r=kjeremy a=kjeremy
Co-authored-by: Jeremy Kolb <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/caps.rs | 14 | ||||
-rw-r--r-- | crates/rust-analyzer/src/diagnostics/to_proto.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 12 | ||||
-rw-r--r-- | crates/rust-analyzer/src/lsp_ext.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/to_proto.rs | 15 | ||||
-rw-r--r-- | crates/rust-analyzer/test_data/rustc_unused_variable.txt | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/test_data/snap_multi_line_fix.txt | 4 |
10 files changed, 38 insertions, 29 deletions
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index dc8dbbe77..676a04269 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -20,7 +20,7 @@ globset = "0.4.4" | |||
20 | itertools = "0.9.0" | 20 | itertools = "0.9.0" |
21 | jod-thread = "0.1.0" | 21 | jod-thread = "0.1.0" |
22 | log = "0.4.8" | 22 | log = "0.4.8" |
23 | lsp-types = { version = "0.74.0", features = ["proposed"] } | 23 | lsp-types = { version = "0.75.0", features = ["proposed"] } |
24 | parking_lot = "0.11.0" | 24 | parking_lot = "0.11.0" |
25 | pico-args = "0.3.1" | 25 | pico-args = "0.3.1" |
26 | rand = { version = "0.7.3", features = ["small_rng"] } | 26 | rand = { version = "0.7.3", features = ["small_rng"] } |
diff --git a/crates/rust-analyzer/src/caps.rs b/crates/rust-analyzer/src/caps.rs index 070ad5e68..f999c730a 100644 --- a/crates/rust-analyzer/src/caps.rs +++ b/crates/rust-analyzer/src/caps.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | use std::env; | 2 | use std::env; |
3 | 3 | ||
4 | use lsp_types::{ | 4 | use lsp_types::{ |
5 | CallHierarchyServerCapability, ClientCapabilities, CodeActionOptions, | 5 | CallHierarchyServerCapability, ClientCapabilities, CodeActionKind, CodeActionOptions, |
6 | CodeActionProviderCapability, CodeLensOptions, CompletionOptions, | 6 | CodeActionProviderCapability, CodeLensOptions, CompletionOptions, |
7 | DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, | 7 | DocumentOnTypeFormattingOptions, FoldingRangeProviderCapability, |
8 | ImplementationProviderCapability, RenameOptions, RenameProviderCapability, SaveOptions, | 8 | ImplementationProviderCapability, RenameOptions, RenameProviderCapability, SaveOptions, |
@@ -106,12 +106,12 @@ fn code_action_capabilities(client_caps: &ClientCapabilities) -> CodeActionProvi | |||
106 | // Ideally we would base this off of the client capabilities | 106 | // Ideally we would base this off of the client capabilities |
107 | // but the client is supposed to fall back gracefully for unknown values. | 107 | // but the client is supposed to fall back gracefully for unknown values. |
108 | code_action_kinds: Some(vec![ | 108 | code_action_kinds: Some(vec![ |
109 | lsp_types::code_action_kind::EMPTY.to_string(), | 109 | CodeActionKind::EMPTY, |
110 | lsp_types::code_action_kind::QUICKFIX.to_string(), | 110 | CodeActionKind::QUICKFIX, |
111 | lsp_types::code_action_kind::REFACTOR.to_string(), | 111 | CodeActionKind::REFACTOR, |
112 | lsp_types::code_action_kind::REFACTOR_EXTRACT.to_string(), | 112 | CodeActionKind::REFACTOR_EXTRACT, |
113 | lsp_types::code_action_kind::REFACTOR_INLINE.to_string(), | 113 | CodeActionKind::REFACTOR_INLINE, |
114 | lsp_types::code_action_kind::REFACTOR_REWRITE.to_string(), | 114 | CodeActionKind::REFACTOR_REWRITE, |
115 | ]), | 115 | ]), |
116 | work_done_progress_options: Default::default(), | 116 | work_done_progress_options: Default::default(), |
117 | }) | 117 | }) |
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs index 1b1e670c1..7be3ef984 100644 --- a/crates/rust-analyzer/src/diagnostics/to_proto.rs +++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs | |||
@@ -112,7 +112,7 @@ fn map_rust_child_diagnostic( | |||
112 | title: rd.message.clone(), | 112 | title: rd.message.clone(), |
113 | id: None, | 113 | id: None, |
114 | group: None, | 114 | group: None, |
115 | kind: Some("quickfix".to_string()), | 115 | kind: Some(lsp_types::CodeActionKind::QUICKFIX), |
116 | edit: Some(lsp_ext::SnippetWorkspaceEdit { | 116 | edit: Some(lsp_ext::SnippetWorkspaceEdit { |
117 | // FIXME: there's no good reason to use edit_map here.... | 117 | // FIXME: there's no good reason to use edit_map here.... |
118 | changes: Some(edit_map), | 118 | changes: Some(edit_map), |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 85758eed6..f2e24178a 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -11,11 +11,11 @@ use lsp_server::ErrorCode; | |||
11 | use lsp_types::{ | 11 | use lsp_types::{ |
12 | CallHierarchyIncomingCall, CallHierarchyIncomingCallsParams, CallHierarchyItem, | 12 | CallHierarchyIncomingCall, CallHierarchyIncomingCallsParams, CallHierarchyItem, |
13 | CallHierarchyOutgoingCall, CallHierarchyOutgoingCallsParams, CallHierarchyPrepareParams, | 13 | CallHierarchyOutgoingCall, CallHierarchyOutgoingCallsParams, CallHierarchyPrepareParams, |
14 | CodeLens, Command, CompletionItem, Diagnostic, DocumentFormattingParams, DocumentHighlight, | 14 | CodeActionKind, CodeLens, Command, CompletionItem, Diagnostic, DocumentFormattingParams, |
15 | DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location, Position, | 15 | DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeParams, HoverContents, Location, |
16 | PrepareRenameResponse, Range, RenameParams, SemanticTokensParams, SemanticTokensRangeParams, | 16 | Position, PrepareRenameResponse, Range, RenameParams, SemanticTokensParams, |
17 | SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, TextDocumentIdentifier, | 17 | SemanticTokensRangeParams, SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, |
18 | Url, WorkspaceEdit, | 18 | TextDocumentIdentifier, Url, WorkspaceEdit, |
19 | }; | 19 | }; |
20 | use ra_ide::{ | 20 | use ra_ide::{ |
21 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, | 21 | FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, |
@@ -760,7 +760,7 @@ fn handle_fixes( | |||
760 | title, | 760 | title, |
761 | id: None, | 761 | id: None, |
762 | group: None, | 762 | group: None, |
763 | kind: Some(lsp_types::code_action_kind::QUICKFIX.into()), | 763 | kind: Some(CodeActionKind::QUICKFIX), |
764 | edit: Some(edit), | 764 | edit: Some(edit), |
765 | }; | 765 | }; |
766 | res.push(action); | 766 | res.push(action); |
diff --git a/crates/rust-analyzer/src/lsp_ext.rs b/crates/rust-analyzer/src/lsp_ext.rs index a3e12c046..e216966a9 100644 --- a/crates/rust-analyzer/src/lsp_ext.rs +++ b/crates/rust-analyzer/src/lsp_ext.rs | |||
@@ -3,7 +3,9 @@ | |||
3 | use std::{collections::HashMap, path::PathBuf}; | 3 | use std::{collections::HashMap, path::PathBuf}; |
4 | 4 | ||
5 | use lsp_types::request::Request; | 5 | use lsp_types::request::Request; |
6 | use lsp_types::{notification::Notification, Position, Range, TextDocumentIdentifier}; | 6 | use lsp_types::{ |
7 | notification::Notification, CodeActionKind, Position, Range, TextDocumentIdentifier, | ||
8 | }; | ||
7 | use serde::{Deserialize, Serialize}; | 9 | use serde::{Deserialize, Serialize}; |
8 | 10 | ||
9 | pub enum AnalyzerStatus {} | 11 | pub enum AnalyzerStatus {} |
@@ -248,7 +250,7 @@ pub struct CodeAction { | |||
248 | #[serde(skip_serializing_if = "Option::is_none")] | 250 | #[serde(skip_serializing_if = "Option::is_none")] |
249 | pub group: Option<String>, | 251 | pub group: Option<String>, |
250 | #[serde(skip_serializing_if = "Option::is_none")] | 252 | #[serde(skip_serializing_if = "Option::is_none")] |
251 | pub kind: Option<String>, | 253 | pub kind: Option<CodeActionKind>, |
252 | // We don't handle commands on the client-side | 254 | // We don't handle commands on the client-side |
253 | // #[serde(skip_serializing_if = "Option::is_none")] | 255 | // #[serde(skip_serializing_if = "Option::is_none")] |
254 | // pub command: Option<lsp_types::Command>, | 256 | // pub command: Option<lsp_types::Command>, |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index f6d2f4fc4..3585202a4 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -629,16 +629,15 @@ pub(crate) fn call_hierarchy_item( | |||
629 | Ok(lsp_types::CallHierarchyItem { name, kind, tags: None, detail, uri, range, selection_range }) | 629 | Ok(lsp_types::CallHierarchyItem { name, kind, tags: None, detail, uri, range, selection_range }) |
630 | } | 630 | } |
631 | 631 | ||
632 | pub(crate) fn code_action_kind(kind: AssistKind) -> String { | 632 | pub(crate) fn code_action_kind(kind: AssistKind) -> lsp_types::CodeActionKind { |
633 | match kind { | 633 | match kind { |
634 | AssistKind::None | AssistKind::Generate => lsp_types::code_action_kind::EMPTY, | 634 | AssistKind::None | AssistKind::Generate => lsp_types::CodeActionKind::EMPTY, |
635 | AssistKind::QuickFix => lsp_types::code_action_kind::QUICKFIX, | 635 | AssistKind::QuickFix => lsp_types::CodeActionKind::QUICKFIX, |
636 | AssistKind::Refactor => lsp_types::code_action_kind::REFACTOR, | 636 | AssistKind::Refactor => lsp_types::CodeActionKind::REFACTOR, |
637 | AssistKind::RefactorExtract => lsp_types::code_action_kind::REFACTOR_EXTRACT, | 637 | AssistKind::RefactorExtract => lsp_types::CodeActionKind::REFACTOR_EXTRACT, |
638 | AssistKind::RefactorInline => lsp_types::code_action_kind::REFACTOR_INLINE, | 638 | AssistKind::RefactorInline => lsp_types::CodeActionKind::REFACTOR_INLINE, |
639 | AssistKind::RefactorRewrite => lsp_types::code_action_kind::REFACTOR_REWRITE, | 639 | AssistKind::RefactorRewrite => lsp_types::CodeActionKind::REFACTOR_REWRITE, |
640 | } | 640 | } |
641 | .to_string() | ||
642 | } | 641 | } |
643 | 642 | ||
644 | pub(crate) fn unresolved_code_action( | 643 | pub(crate) fn unresolved_code_action( |
diff --git a/crates/rust-analyzer/test_data/rustc_unused_variable.txt b/crates/rust-analyzer/test_data/rustc_unused_variable.txt index 92aea088b..084632757 100644 --- a/crates/rust-analyzer/test_data/rustc_unused_variable.txt +++ b/crates/rust-analyzer/test_data/rustc_unused_variable.txt | |||
@@ -37,7 +37,9 @@ | |||
37 | id: None, | 37 | id: None, |
38 | group: None, | 38 | group: None, |
39 | kind: Some( | 39 | kind: Some( |
40 | "quickfix", | 40 | CodeActionKind( |
41 | "quickfix", | ||
42 | ), | ||
41 | ), | 43 | ), |
42 | edit: Some( | 44 | edit: Some( |
43 | SnippetWorkspaceEdit { | 45 | SnippetWorkspaceEdit { |
diff --git a/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt b/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt index 80cf0d8a5..d637923c5 100644 --- a/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt +++ b/crates/rust-analyzer/test_data/rustc_unused_variable_as_hint.txt | |||
@@ -37,7 +37,9 @@ | |||
37 | id: None, | 37 | id: None, |
38 | group: None, | 38 | group: None, |
39 | kind: Some( | 39 | kind: Some( |
40 | "quickfix", | 40 | CodeActionKind( |
41 | "quickfix", | ||
42 | ), | ||
41 | ), | 43 | ), |
42 | edit: Some( | 44 | edit: Some( |
43 | SnippetWorkspaceEdit { | 45 | SnippetWorkspaceEdit { |
diff --git a/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt b/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt index afe3cb6d8..6b48f16ed 100644 --- a/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt +++ b/crates/rust-analyzer/test_data/rustc_unused_variable_as_info.txt | |||
@@ -37,7 +37,9 @@ | |||
37 | id: None, | 37 | id: None, |
38 | group: None, | 38 | group: None, |
39 | kind: Some( | 39 | kind: Some( |
40 | "quickfix", | 40 | CodeActionKind( |
41 | "quickfix", | ||
42 | ), | ||
41 | ), | 43 | ), |
42 | edit: Some( | 44 | edit: Some( |
43 | SnippetWorkspaceEdit { | 45 | SnippetWorkspaceEdit { |
diff --git a/crates/rust-analyzer/test_data/snap_multi_line_fix.txt b/crates/rust-analyzer/test_data/snap_multi_line_fix.txt index 7814d3543..2c4cbea16 100644 --- a/crates/rust-analyzer/test_data/snap_multi_line_fix.txt +++ b/crates/rust-analyzer/test_data/snap_multi_line_fix.txt | |||
@@ -52,7 +52,9 @@ | |||
52 | id: None, | 52 | id: None, |
53 | group: None, | 53 | group: None, |
54 | kind: Some( | 54 | kind: Some( |
55 | "quickfix", | 55 | CodeActionKind( |
56 | "quickfix", | ||
57 | ), | ||
56 | ), | 58 | ), |
57 | edit: Some( | 59 | edit: Some( |
58 | SnippetWorkspaceEdit { | 60 | SnippetWorkspaceEdit { |