aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/to_proto.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-15 09:26:58 +0000
committerGitHub <[email protected]>2021-03-15 09:26:58 +0000
commitcec676d08236076a48a9fdae28cf0e716ae99b16 (patch)
tree6fb2e73e2d8ba57779f986fd02856e9fda30679e /crates/rust-analyzer/src/to_proto.rs
parentde360275416ca095102f2b17d6ca1de3bd091fdb (diff)
parentd6977550dd3cdfa012d30c12d8b89776070ab7af (diff)
Merge #7975
7975: Provide regions in file structure r=ivan770 a=ivan770 Closes #7913 https://user-images.githubusercontent.com/14003886/110819163-96b3c080-8296-11eb-993e-a7cdb574a12d.mp4 Co-authored-by: ivan770 <[email protected]>
Diffstat (limited to 'crates/rust-analyzer/src/to_proto.rs')
-rw-r--r--crates/rust-analyzer/src/to_proto.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index d415ed4d3..ab742a17c 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -11,7 +11,7 @@ use ide::{
11 Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange, 11 Markup, NavigationTarget, ReferenceAccess, RenameError, Runnable, Severity, SourceChange,
12 TextEdit, TextRange, TextSize, 12 TextEdit, TextRange, TextSize,
13}; 13};
14use ide_db::SymbolKind; 14use ide_db::{StructureNodeKind, SymbolKind};
15use itertools::Itertools; 15use itertools::Itertools;
16use serde_json::to_value; 16use serde_json::to_value;
17 17
@@ -63,6 +63,13 @@ pub(crate) fn symbol_kind(symbol_kind: SymbolKind) -> lsp_types::SymbolKind {
63 } 63 }
64} 64}
65 65
66pub(crate) fn structure_node_kind(kind: StructureNodeKind) -> lsp_types::SymbolKind {
67 match kind {
68 StructureNodeKind::SymbolKind(symbol) => symbol_kind(symbol),
69 StructureNodeKind::Region => lsp_types::SymbolKind::Namespace,
70 }
71}
72
66pub(crate) fn document_highlight_kind( 73pub(crate) fn document_highlight_kind(
67 reference_access: ReferenceAccess, 74 reference_access: ReferenceAccess,
68) -> lsp_types::DocumentHighlightKind { 75) -> lsp_types::DocumentHighlightKind {