aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/navigation_target.rs
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-02-12 19:47:51 +0000
committerVille Penttinen <[email protected]>2019-02-12 20:06:14 +0000
commitdd6307ddc4535bef09e2b14caff5acfaeb88891e (patch)
tree4e1511826adb09561572ed8eb405f0ad8d84f42a /crates/ra_ide_api/src/navigation_target.rs
parent61324a845bde0959c1f9ac86ce31d022812f4c21 (diff)
Add support for container_name in workspace/symbol query
Diffstat (limited to 'crates/ra_ide_api/src/navigation_target.rs')
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs
index a2e4b6506..bcacbe6fc 100644
--- a/crates/ra_ide_api/src/navigation_target.rs
+++ b/crates/ra_ide_api/src/navigation_target.rs
@@ -19,6 +19,7 @@ pub struct NavigationTarget {
19 kind: SyntaxKind, 19 kind: SyntaxKind,
20 full_range: TextRange, 20 full_range: TextRange,
21 focus_range: Option<TextRange>, 21 focus_range: Option<TextRange>,
22 container_name: Option<SmolStr>,
22} 23}
23 24
24impl NavigationTarget { 25impl NavigationTarget {
@@ -26,6 +27,10 @@ impl NavigationTarget {
26 &self.name 27 &self.name
27 } 28 }
28 29
30 pub fn container_name(&self) -> Option<&SmolStr> {
31 self.container_name.as_ref()
32 }
33
29 pub fn kind(&self) -> SyntaxKind { 34 pub fn kind(&self) -> SyntaxKind {
30 self.kind 35 self.kind
31 } 36 }
@@ -53,6 +58,7 @@ impl NavigationTarget {
53 kind: symbol.ptr.kind(), 58 kind: symbol.ptr.kind(),
54 full_range: symbol.ptr.range(), 59 full_range: symbol.ptr.range(),
55 focus_range: None, 60 focus_range: None,
61 container_name: symbol.container_name.map(|v| v.clone()),
56 } 62 }
57 } 63 }
58 64
@@ -67,6 +73,7 @@ impl NavigationTarget {
67 full_range: ptr.range(), 73 full_range: ptr.range(),
68 focus_range: None, 74 focus_range: None,
69 kind: NAME, 75 kind: NAME,
76 container_name: None,
70 } 77 }
71 } 78 }
72 79
@@ -170,6 +177,9 @@ impl NavigationTarget {
170 if let Some(focus_range) = self.focus_range() { 177 if let Some(focus_range) = self.focus_range() {
171 buf.push_str(&format!(" {:?}", focus_range)) 178 buf.push_str(&format!(" {:?}", focus_range))
172 } 179 }
180 if let Some(container_name) = self.container_name() {
181 buf.push_str(&format!(" {:?}", container_name))
182 }
173 buf 183 buf
174 } 184 }
175 185
@@ -192,6 +202,7 @@ impl NavigationTarget {
192 full_range: node.range(), 202 full_range: node.range(),
193 focus_range, 203 focus_range,
194 // ptr: Some(LocalSyntaxPtr::new(node)), 204 // ptr: Some(LocalSyntaxPtr::new(node)),
205 container_name: None,
195 } 206 }
196 } 207 }
197} 208}