aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock4
-rw-r--r--crates/rust-analyzer/Cargo.toml2
-rw-r--r--crates/rust-analyzer/src/caps.rs14
-rw-r--r--crates/rust-analyzer/src/diagnostics/to_proto.rs2
-rw-r--r--crates/rust-analyzer/src/handlers.rs12
-rw-r--r--crates/rust-analyzer/src/lsp_ext.rs6
-rw-r--r--crates/rust-analyzer/src/to_proto.rs15
7 files changed, 28 insertions, 27 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e564016d2..292ddb982 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -691,9 +691,9 @@ dependencies = [
691 691
692[[package]] 692[[package]]
693name = "lsp-types" 693name = "lsp-types"
694version = "0.74.2" 694version = "0.75.0"
695source = "registry+https://github.com/rust-lang/crates.io-index" 695source = "registry+https://github.com/rust-lang/crates.io-index"
696checksum = "b360754e89e0e13c114245131382ba921d4ff1efabb918e549422938aaa8d392" 696checksum = "a1b4ab1df4a5538413c707860e13fff9e0c9bc2fa613efc15d78196bc06ae06d"
697dependencies = [ 697dependencies = [
698 "base64", 698 "base64",
699 "bitflags", 699 "bitflags",
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"
20itertools = "0.9.0" 20itertools = "0.9.0"
21jod-thread = "0.1.0" 21jod-thread = "0.1.0"
22log = "0.4.8" 22log = "0.4.8"
23lsp-types = { version = "0.74.0", features = ["proposed"] } 23lsp-types = { version = "0.75.0", features = ["proposed"] }
24parking_lot = "0.11.0" 24parking_lot = "0.11.0"
25pico-args = "0.3.1" 25pico-args = "0.3.1"
26rand = { version = "0.7.3", features = ["small_rng"] } 26rand = { 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 @@
2use std::env; 2use std::env;
3 3
4use lsp_types::{ 4use 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 d39dceae0..8a06ff4b6 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -11,11 +11,11 @@ use lsp_server::ErrorCode;
11use lsp_types::{ 11use 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};
20use ra_ide::{ 20use 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 @@
3use std::{collections::HashMap, path::PathBuf}; 3use std::{collections::HashMap, path::PathBuf};
4 4
5use lsp_types::request::Request; 5use lsp_types::request::Request;
6use lsp_types::{notification::Notification, Position, Range, TextDocumentIdentifier}; 6use lsp_types::{
7 notification::Notification, CodeActionKind, Position, Range, TextDocumentIdentifier,
8};
7use serde::{Deserialize, Serialize}; 9use serde::{Deserialize, Serialize};
8 10
9pub enum AnalyzerStatus {} 11pub 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
632pub(crate) fn code_action_kind(kind: AssistKind) -> String { 632pub(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
644pub(crate) fn unresolved_code_action( 643pub(crate) fn unresolved_code_action(