aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/to_proto.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-12-18 18:10:13 +0000
committerAleksey Kladov <[email protected]>2020-12-18 18:15:48 +0000
commit0e3581e8232461baa50191a2c7474a117b649b1b (patch)
tree4e78794bf926ef2a0878abd6058f2958713725b4 /crates/rust-analyzer/src/to_proto.rs
parent53f81e4e8c8307069d89cee58cb12142350b09c2 (diff)
NavTarget doesn't assume that it points to a symbol
Diffstat (limited to 'crates/rust-analyzer/src/to_proto.rs')
-rw-r--r--crates/rust-analyzer/src/to_proto.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 79caafe80..6b2302803 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -43,10 +43,9 @@ pub(crate) fn symbol_kind(symbol_kind: SymbolKind) -> lsp_types::SymbolKind {
43 SymbolKind::Static => lsp_types::SymbolKind::Constant, 43 SymbolKind::Static => lsp_types::SymbolKind::Constant,
44 SymbolKind::Const => lsp_types::SymbolKind::Constant, 44 SymbolKind::Const => lsp_types::SymbolKind::Constant,
45 SymbolKind::Impl => lsp_types::SymbolKind::Object, 45 SymbolKind::Impl => lsp_types::SymbolKind::Object,
46 SymbolKind::Local 46 SymbolKind::Local | SymbolKind::SelfParam | SymbolKind::LifetimeParam => {
47 | SymbolKind::SelfParam 47 lsp_types::SymbolKind::Variable
48 | SymbolKind::LifetimeParam 48 }
49 | SymbolKind::DocTest => lsp_types::SymbolKind::Variable,
50 SymbolKind::Union => lsp_types::SymbolKind::Struct, 49 SymbolKind::Union => lsp_types::SymbolKind::Struct,
51 } 50 }
52} 51}
@@ -722,7 +721,7 @@ pub(crate) fn call_hierarchy_item(
722) -> Result<lsp_types::CallHierarchyItem> { 721) -> Result<lsp_types::CallHierarchyItem> {
723 let name = target.name.to_string(); 722 let name = target.name.to_string();
724 let detail = target.description.clone(); 723 let detail = target.description.clone();
725 let kind = symbol_kind(target.kind); 724 let kind = target.kind.map(symbol_kind).unwrap_or(lsp_types::SymbolKind::Function);
726 let (uri, range, selection_range) = location_info(snap, target)?; 725 let (uri, range, selection_range) = location_info(snap, target)?;
727 Ok(lsp_types::CallHierarchyItem { 726 Ok(lsp_types::CallHierarchyItem {
728 name, 727 name,