Unnamed repository; edit this file 'description' to name the repository.
Merge #10551
10551: Pull in new lsp-types for VS compat r=lnicola a=lnicola CC #8729 Depends on https://github.com/gluon-lang/lsp-types/pull/218 Co-authored-by: LaurenČ›iu Nicola <[email protected]>
bors[bot] 2021-10-18
parent 91cbda4 · parent 29d281e · commit 5ce9b04
-rw-r--r--Cargo.lock4
-rw-r--r--crates/rust-analyzer/Cargo.toml9
-rw-r--r--crates/rust-analyzer/src/caps.rs2
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt12
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt4
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt12
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt4
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt4
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt12
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt12
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt12
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt8
-rw-r--r--crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt12
-rw-r--r--crates/rust-analyzer/src/diagnostics/to_proto.rs22
-rw-r--r--crates/rust-analyzer/src/handlers.rs8
-rw-r--r--crates/rust-analyzer/src/lsp_utils.rs2
-rw-r--r--crates/rust-analyzer/src/main_loop.rs6
-rw-r--r--crates/rust-analyzer/src/to_proto.rs104
18 files changed, 150 insertions, 99 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ca0febcfd0..d673f72cf8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -865,9 +865,9 @@ dependencies = [
[[package]]
name = "lsp-types"
-version = "0.90.1"
+version = "0.91.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f3734ab1d7d157fc0c45110e06b587c31cd82bea2ccfd6b563cbff0aaeeb1d3"
+checksum = "be7801b458592d0998af808d97f6a85a6057af3aaf2a2a5c3c677702bbeb4ed7"
dependencies = [
"bitflags",
"serde",
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index c67c094b53..2d3d00fd98 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -22,7 +22,7 @@ crossbeam-channel = "0.5.0"
dissimilar = "1.0.2"
itertools = "0.10.0"
jod-thread = "0.1.0"
-lsp-types = { version = "0.90.1", features = ["proposed"] }
+lsp-types = { version = "0.91", features = ["proposed"] }
parking_lot = "0.11.0"
xflags = "0.2.1"
oorandom = "11.1.2"
@@ -34,7 +34,12 @@ rayon = "1.5"
mimalloc = { version = "0.1.19", default-features = false, optional = true }
lsp-server = "0.5.1"
tracing = "0.1"
-tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry", "fmt", "tracing-log"] }
+tracing-subscriber = { version = "0.2", default-features = false, features = [
+ "env-filter",
+ "registry",
+ "fmt",
+ "tracing-log",
+] }
tracing-log = "0.1.2"
tracing-tree = { version = "0.1.10" }
always-assert = "0.1"
diff --git a/crates/rust-analyzer/src/caps.rs b/crates/rust-analyzer/src/caps.rs
index 1823fddc08..648f6aeebe 100644
--- a/crates/rust-analyzer/src/caps.rs
+++ b/crates/rust-analyzer/src/caps.rs
@@ -20,7 +20,7 @@ pub fn server_capabilities(config: &Config) -> ServerCapabilities {
ServerCapabilities {
text_document_sync: Some(TextDocumentSyncCapability::Options(TextDocumentSyncOptions {
open_close: Some(true),
- change: Some(TextDocumentSyncKind::Incremental),
+ change: Some(TextDocumentSyncKind::INCREMENTAL),
will_save: None,
will_save_wait_until: None,
save: Some(SaveOptions::default().into()),
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt
index fd04163de9..a9c0edcf9f 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/clippy_pass_by_ref.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Warning,
+ DiagnosticSeverity(
+ 2,
+ ),
),
code: Some(
String(
@@ -140,7 +142,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
@@ -231,7 +235,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
index a7f936a703..fd69097d05 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/handles_macro_location.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Error,
+ DiagnosticSeverity(
+ 1,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt
index 8bee4cfe10..1c25a3ed69 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/macro_compiler_error.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: None,
code_description: None,
@@ -90,7 +92,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: None,
code_description: None,
@@ -157,7 +161,9 @@
},
},
severity: Some(
- Error,
+ DiagnosticSeverity(
+ 1,
+ ),
),
code: None,
code_description: None,
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
index afc562a0e2..653fb0130d 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_incompatible_type_for_trait.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Error,
+ DiagnosticSeverity(
+ 1,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt
index 05074a914b..f37e416b7b 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_mismatched_type.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Error,
+ DiagnosticSeverity(
+ 1,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt
index 3ded70411d..df73efe5f8 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Warning,
+ DiagnosticSeverity(
+ 2,
+ ),
),
code: Some(
String(
@@ -67,7 +69,9 @@
),
tags: Some(
[
- Unnecessary,
+ DiagnosticTag(
+ 1,
+ ),
],
),
data: None,
@@ -98,7 +102,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt
index 0993aa1af1..ad22a34d67 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_hint.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
@@ -67,7 +69,9 @@
),
tags: Some(
[
- Unnecessary,
+ DiagnosticTag(
+ 1,
+ ),
],
),
data: None,
@@ -98,7 +102,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt
index d7a974ae57..1072d8a177 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_unused_variable_as_info.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Information,
+ DiagnosticSeverity(
+ 3,
+ ),
),
code: Some(
String(
@@ -67,7 +69,9 @@
),
tags: Some(
[
- Unnecessary,
+ DiagnosticTag(
+ 1,
+ ),
],
),
data: None,
@@ -98,7 +102,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt
index 5ea27a1527..3e043666aa 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/rustc_wrong_number_of_parameters.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Error,
+ DiagnosticSeverity(
+ 1,
+ ),
),
code: Some(
String(
@@ -114,7 +116,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt
index f77abde515..67e442d73d 100644
--- a/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt
+++ b/crates/rust-analyzer/src/diagnostics/test_data/snap_multi_line_fix.txt
@@ -23,7 +23,9 @@
},
},
severity: Some(
- Warning,
+ DiagnosticSeverity(
+ 2,
+ ),
),
code: Some(
String(
@@ -140,7 +142,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
@@ -231,7 +235,9 @@
},
},
severity: Some(
- Hint,
+ DiagnosticSeverity(
+ 4,
+ ),
),
code: Some(
String(
diff --git a/crates/rust-analyzer/src/diagnostics/to_proto.rs b/crates/rust-analyzer/src/diagnostics/to_proto.rs
index 4739cabae5..b9b8f3a1b1 100644
--- a/crates/rust-analyzer/src/diagnostics/to_proto.rs
+++ b/crates/rust-analyzer/src/diagnostics/to_proto.rs
@@ -18,19 +18,19 @@ fn diagnostic_severity(
code: Option<flycheck::DiagnosticCode>,
) -> Option<lsp_types::DiagnosticSeverity> {
let res = match level {
- DiagnosticLevel::Ice => lsp_types::DiagnosticSeverity::Error,
- DiagnosticLevel::Error => lsp_types::DiagnosticSeverity::Error,
+ DiagnosticLevel::Ice => lsp_types::DiagnosticSeverity::ERROR,
+ DiagnosticLevel::Error => lsp_types::DiagnosticSeverity::ERROR,
DiagnosticLevel::Warning => match &code {
Some(code) if config.warnings_as_hint.contains(&code.code) => {
- lsp_types::DiagnosticSeverity::Hint
+ lsp_types::DiagnosticSeverity::HINT
}
Some(code) if config.warnings_as_info.contains(&code.code) => {
- lsp_types::DiagnosticSeverity::Information
+ lsp_types::DiagnosticSeverity::INFORMATION
}
- _ => lsp_types::DiagnosticSeverity::Warning,
+ _ => lsp_types::DiagnosticSeverity::WARNING,
},
- DiagnosticLevel::Note => lsp_types::DiagnosticSeverity::Information,
- DiagnosticLevel::Help => lsp_types::DiagnosticSeverity::Hint,
+ DiagnosticLevel::Note => lsp_types::DiagnosticSeverity::INFORMATION,
+ DiagnosticLevel::Help => lsp_types::DiagnosticSeverity::HINT,
_ => return None,
};
Some(res)
@@ -268,11 +268,11 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
| "unused_macros"
| "unused_variables"
) {
- tags.push(lsp_types::DiagnosticTag::Unnecessary);
+ tags.push(lsp_types::DiagnosticTag::UNNECESSARY);
}
if matches!(code, "deprecated") {
- tags.push(lsp_types::DiagnosticTag::Deprecated);
+ tags.push(lsp_types::DiagnosticTag::DEPRECATED);
}
}
@@ -337,7 +337,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
let diagnostic = lsp_types::Diagnostic {
range: secondary_location.range,
// downgrade to hint if we're pointing at the macro
- severity: Some(lsp_types::DiagnosticSeverity::Hint),
+ severity: Some(lsp_types::DiagnosticSeverity::HINT),
code: code.clone().map(lsp_types::NumberOrString::String),
code_description: code_description.clone(),
source: Some(source.clone()),
@@ -398,7 +398,7 @@ pub(crate) fn map_rust_diagnostic_to_lsp(
fixes: sub.suggested_fix.iter().cloned().collect(),
diagnostic: lsp_types::Diagnostic {
range: sub.related.location.range,
- severity: Some(lsp_types::DiagnosticSeverity::Hint),
+ severity: Some(lsp_types::DiagnosticSeverity::HINT),
code: code.clone().map(lsp_types::NumberOrString::String),
code_description: code_description.clone(),
source: Some(source.clone()),
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 7d46cee214..ab656d4789 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -311,7 +311,7 @@ pub(crate) fn handle_document_symbol(
for symbol in snap.analysis.file_structure(file_id)? {
let mut tags = Vec::new();
if symbol.deprecated {
- tags.push(SymbolTag::Deprecated)
+ tags.push(SymbolTag::DEPRECATED)
};
#[allow(deprecated)]
@@ -368,7 +368,7 @@ pub(crate) fn handle_document_symbol(
#[allow(deprecated)]
if let Some(true) = symbol.deprecated {
- tags.push(SymbolTag::Deprecated)
+ tags.push(SymbolTag::DEPRECATED)
}
#[allow(deprecated)]
@@ -464,7 +464,7 @@ pub(crate) fn handle_workspace_symbol(
kind: nav
.kind
.map(to_proto::symbol_kind)
- .unwrap_or(lsp_types::SymbolKind::Variable),
+ .unwrap_or(lsp_types::SymbolKind::VARIABLE),
tags: None,
location: to_proto::location_from_nav(snap, nav)?,
container_name,
@@ -1294,7 +1294,7 @@ pub(crate) fn publish_diagnostics(
source: Some("rust-analyzer".to_string()),
message: d.message,
related_information: None,
- tags: if d.unused { Some(vec![DiagnosticTag::Unnecessary]) } else { None },
+ tags: if d.unused { Some(vec![DiagnosticTag::UNNECESSARY]) } else { None },
data: None,
})
.collect();
diff --git a/crates/rust-analyzer/src/lsp_utils.rs b/crates/rust-analyzer/src/lsp_utils.rs
index 9e7c265a80..194d030322 100644
--- a/crates/rust-analyzer/src/lsp_utils.rs
+++ b/crates/rust-analyzer/src/lsp_utils.rs
@@ -62,7 +62,7 @@ impl GlobalState {
let from_source_build = env!("REV").contains("dev");
let profiling_enabled = std::env::var("RA_PROFILE").is_ok();
if from_source_build || profiling_enabled {
- self.show_message(lsp_types::MessageType::Error, message)
+ self.show_message(lsp_types::MessageType::ERROR, message)
}
}
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 6dd1c76c2e..9f08ad5ebf 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -112,7 +112,7 @@ impl GlobalState {
&& self.config.notifications().cargo_toml_not_found
{
self.show_message(
- lsp_types::MessageType::Error,
+ lsp_types::MessageType::ERROR,
"rust-analyzer failed to discover workspace".to_string(),
);
};
@@ -395,7 +395,7 @@ impl GlobalState {
flycheck::Progress::DidFinish(result) => {
if let Err(err) = result {
self.show_message(
- lsp_types::MessageType::Error,
+ lsp_types::MessageType::ERROR,
format!("cargo check failed: {}", err),
);
}
@@ -509,7 +509,7 @@ impl GlobalState {
self.last_reported_status = Some(status.clone());
if let (lsp_ext::Health::Error, Some(message)) = (status.health, &status.message) {
- self.show_message(lsp_types::MessageType::Error, message.clone());
+ self.show_message(lsp_types::MessageType::ERROR, message.clone());
}
if self.config.server_status_notification() {
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 9e94793a61..b17711d6a6 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -45,32 +45,32 @@ pub(crate) fn range(line_index: &LineIndex, range: TextRange) -> lsp_types::Rang
pub(crate) fn symbol_kind(symbol_kind: SymbolKind) -> lsp_types::SymbolKind {
match symbol_kind {
- SymbolKind::Function => lsp_types::SymbolKind::Function,
- SymbolKind::Struct => lsp_types::SymbolKind::Struct,
- SymbolKind::Enum => lsp_types::SymbolKind::Enum,
- SymbolKind::Variant => lsp_types::SymbolKind::EnumMember,
- SymbolKind::Trait => lsp_types::SymbolKind::Interface,
- SymbolKind::Macro => lsp_types::SymbolKind::Function,
- SymbolKind::Module => lsp_types::SymbolKind::Module,
- SymbolKind::TypeAlias | SymbolKind::TypeParam => lsp_types::SymbolKind::TypeParameter,
- SymbolKind::Field => lsp_types::SymbolKind::Field,
- SymbolKind::Static => lsp_types::SymbolKind::Constant,
- SymbolKind::Const => lsp_types::SymbolKind::Constant,
- SymbolKind::ConstParam => lsp_types::SymbolKind::Constant,
- SymbolKind::Impl => lsp_types::SymbolKind::Object,
+ SymbolKind::Function => lsp_types::SymbolKind::FUNCTION,
+ SymbolKind::Struct => lsp_types::SymbolKind::STRUCT,
+ SymbolKind::Enum => lsp_types::SymbolKind::ENUM,
+ SymbolKind::Variant => lsp_types::SymbolKind::ENUM_MEMBER,
+ SymbolKind::Trait => lsp_types::SymbolKind::INTERFACE,
+ SymbolKind::Macro => lsp_types::SymbolKind::FUNCTION,
+ SymbolKind::Module => lsp_types::SymbolKind::MODULE,
+ SymbolKind::TypeAlias | SymbolKind::TypeParam => lsp_types::SymbolKind::TYPE_PARAMETER,
+ SymbolKind::Field => lsp_types::SymbolKind::FIELD,
+ SymbolKind::Static => lsp_types::SymbolKind::CONSTANT,
+ SymbolKind::Const => lsp_types::SymbolKind::CONSTANT,
+ SymbolKind::ConstParam => lsp_types::SymbolKind::CONSTANT,
+ SymbolKind::Impl => lsp_types::SymbolKind::OBJECT,
SymbolKind::Local
| SymbolKind::SelfParam
| SymbolKind::LifetimeParam
| SymbolKind::ValueParam
- | SymbolKind::Label => lsp_types::SymbolKind::Variable,
- SymbolKind::Union => lsp_types::SymbolKind::Struct,
+ | SymbolKind::Label => lsp_types::SymbolKind::VARIABLE,
+ SymbolKind::Union => lsp_types::SymbolKind::STRUCT,
}
}
pub(crate) fn structure_node_kind(kind: StructureNodeKind) -> lsp_types::SymbolKind {
match kind {
StructureNodeKind::SymbolKind(symbol) => symbol_kind(symbol),
- StructureNodeKind::Region => lsp_types::SymbolKind::Namespace,
+ StructureNodeKind::Region => lsp_types::SymbolKind::NAMESPACE,
}
}
@@ -78,15 +78,15 @@ pub(crate) fn document_highlight_kind(
category: ReferenceCategory,
) -> lsp_types::DocumentHighlightKind {
match category {
- ReferenceCategory::Read => lsp_types::DocumentHighlightKind::Read,
- ReferenceCategory::Write => lsp_types::DocumentHighlightKind::Write,
+ ReferenceCategory::Read => lsp_types::DocumentHighlightKind::READ,
+ ReferenceCategory::Write => lsp_types::DocumentHighlightKind::WRITE,
}
}
pub(crate) fn diagnostic_severity(severity: Severity) -> lsp_types::DiagnosticSeverity {
match severity {
- Severity::Error => lsp_types::DiagnosticSeverity::Error,
- Severity::WeakWarning => lsp_types::DiagnosticSeverity::Hint,
+ Severity::Error => lsp_types::DiagnosticSeverity::ERROR,
+ Severity::WeakWarning => lsp_types::DiagnosticSeverity::HINT,
}
}
@@ -100,34 +100,34 @@ pub(crate) fn completion_item_kind(
completion_item_kind: CompletionItemKind,
) -> lsp_types::CompletionItemKind {
match completion_item_kind {
- CompletionItemKind::Attribute => lsp_types::CompletionItemKind::EnumMember,
- CompletionItemKind::Binding => lsp_types::CompletionItemKind::Variable,
- CompletionItemKind::BuiltinType => lsp_types::CompletionItemKind::Struct,
- CompletionItemKind::Keyword => lsp_types::CompletionItemKind::Keyword,
- CompletionItemKind::Method => lsp_types::CompletionItemKind::Method,
- CompletionItemKind::Snippet => lsp_types::CompletionItemKind::Snippet,
- CompletionItemKind::UnresolvedReference => lsp_types::CompletionItemKind::Reference,
+ CompletionItemKind::Attribute => lsp_types::CompletionItemKind::ENUM_MEMBER,
+ CompletionItemKind::Binding => lsp_types::CompletionItemKind::VARIABLE,
+ CompletionItemKind::BuiltinType => lsp_types::CompletionItemKind::STRUCT,
+ CompletionItemKind::Keyword => lsp_types::CompletionItemKind::KEYWORD,
+ CompletionItemKind::Method => lsp_types::CompletionItemKind::METHOD,
+ CompletionItemKind::Snippet => lsp_types::CompletionItemKind::SNIPPET,
+ CompletionItemKind::UnresolvedReference => lsp_types::CompletionItemKind::REFERENCE,
CompletionItemKind::SymbolKind(symbol) => match symbol {
- SymbolKind::Const => lsp_types::CompletionItemKind::Constant,
- SymbolKind::ConstParam => lsp_types::CompletionItemKind::TypeParameter,
- SymbolKind::Enum => lsp_types::CompletionItemKind::Enum,
- SymbolKind::Field => lsp_types::CompletionItemKind::Field,
- SymbolKind::Function => lsp_types::CompletionItemKind::Function,
- SymbolKind::Impl => lsp_types::CompletionItemKind::Text,
- SymbolKind::Label => lsp_types::CompletionItemKind::Variable,
- SymbolKind::LifetimeParam => lsp_types::CompletionItemKind::TypeParameter,
- SymbolKind::Local => lsp_types::CompletionItemKind::Variable,
- SymbolKind::Macro => lsp_types::CompletionItemKind::Method,
- SymbolKind::Module => lsp_types::CompletionItemKind::Module,
- SymbolKind::SelfParam => lsp_types::CompletionItemKind::Value,
- SymbolKind::Static => lsp_types::CompletionItemKind::Value,
- SymbolKind::Struct => lsp_types::CompletionItemKind::Struct,
- SymbolKind::Trait => lsp_types::CompletionItemKind::Interface,
- SymbolKind::TypeAlias => lsp_types::CompletionItemKind::Struct,
- SymbolKind::TypeParam => lsp_types::CompletionItemKind::TypeParameter,
- SymbolKind::Union => lsp_types::CompletionItemKind::Struct,
- SymbolKind::ValueParam => lsp_types::CompletionItemKind::Value,
- SymbolKind::Variant => lsp_types::CompletionItemKind::EnumMember,
+ SymbolKind::Const => lsp_types::CompletionItemKind::CONSTANT,
+ SymbolKind::ConstParam => lsp_types::CompletionItemKind::TYPE_PARAMETER,
+ SymbolKind::Enum => lsp_types::CompletionItemKind::ENUM,
+ SymbolKind::Field => lsp_types::CompletionItemKind::FIELD,
+ SymbolKind::Function => lsp_types::CompletionItemKind::FUNCTION,
+ SymbolKind::Impl => lsp_types::CompletionItemKind::TEXT,
+ SymbolKind::Label => lsp_types::CompletionItemKind::VARIABLE,
+ SymbolKind::LifetimeParam => lsp_types::CompletionItemKind::TYPE_PARAMETER,
+ SymbolKind::Local => lsp_types::CompletionItemKind::VARIABLE,
+ SymbolKind::Macro => lsp_types::CompletionItemKind::METHOD,
+ SymbolKind::Module => lsp_types::CompletionItemKind::MODULE,
+ SymbolKind::SelfParam => lsp_types::CompletionItemKind::VALUE,
+ SymbolKind::Static => lsp_types::CompletionItemKind::VALUE,
+ SymbolKind::Struct => lsp_types::CompletionItemKind::STRUCT,
+ SymbolKind::Trait => lsp_types::CompletionItemKind::INTERFACE,
+ SymbolKind::TypeAlias => lsp_types::CompletionItemKind::STRUCT,
+ SymbolKind::TypeParam => lsp_types::CompletionItemKind::TYPE_PARAMETER,
+ SymbolKind::Union => lsp_types::CompletionItemKind::STRUCT,
+ SymbolKind::ValueParam => lsp_types::CompletionItemKind::VALUE,
+ SymbolKind::Variant => lsp_types::CompletionItemKind::ENUM_MEMBER,
},
}
}
@@ -165,7 +165,7 @@ pub(crate) fn snippet_text_edit(
) -> lsp_ext::SnippetTextEdit {
let text_edit = text_edit(line_index, indel);
let insert_text_format =
- if is_snippet { Some(lsp_types::InsertTextFormat::Snippet) } else { None };
+ if is_snippet { Some(lsp_types::InsertTextFormat::SNIPPET) } else { None };
lsp_ext::SnippetTextEdit {
range: text_edit.range,
new_text: text_edit.new_text,
@@ -259,7 +259,7 @@ fn completion_item(
set_score(&mut lsp_item, max_relevance, item.relevance());
if item.deprecated() {
- lsp_item.tags = Some(vec![lsp_types::CompletionItemTag::Deprecated])
+ lsp_item.tags = Some(vec![lsp_types::CompletionItemTag::DEPRECATED])
}
if item.trigger_call_info() && config.client_commands().trigger_parameter_hints {
@@ -267,7 +267,7 @@ fn completion_item(
}
if item.is_snippet() {
- lsp_item.insert_text_format = Some(lsp_types::InsertTextFormat::Snippet);
+ lsp_item.insert_text_format = Some(lsp_types::InsertTextFormat::SNIPPET);
}
if config.completion().enable_imports_on_the_fly {
if let imports @ [_, ..] = item.imports_to_add() {
@@ -786,7 +786,7 @@ pub(crate) fn snippet_text_document_ops(
let text_edit = lsp_ext::SnippetTextEdit {
range: lsp_types::Range::default(),
new_text: initial_contents,
- insert_text_format: Some(lsp_types::InsertTextFormat::PlainText),
+ insert_text_format: Some(lsp_types::InsertTextFormat::PLAIN_TEXT),
annotation_id: None,
};
let edit_file =
@@ -908,7 +908,7 @@ pub(crate) fn call_hierarchy_item(
) -> Result<lsp_types::CallHierarchyItem> {
let name = target.name.to_string();
let detail = target.description.clone();
- let kind = target.kind.map(symbol_kind).unwrap_or(lsp_types::SymbolKind::Function);
+ let kind = target.kind.map(symbol_kind).unwrap_or(lsp_types::SymbolKind::FUNCTION);
let (uri, range, selection_range) = location_info(snap, target)?;
Ok(lsp_types::CallHierarchyItem {
name,