aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-20 10:30:22 +0000
committerAleksey Kladov <[email protected]>2019-12-20 10:52:17 +0000
commit67c2aea182c375108ebb8b923f5679e4f7fef1df (patch)
tree00ecd85453675103fe415a7b28c565a2a9e94853 /crates/ra_hir
parentd316ba9a136833c64ba066feb62cf553dd4b3a58 (diff)
Rebuild ra_lsp_server and nest helper function.
Completion now works again, so there's no need not to nest
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/from_source.rs74
1 files changed, 37 insertions, 37 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 4fd7c7573..3b6454a1d 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -212,43 +212,43 @@ impl Module {
212} 212}
213 213
214fn analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> DynMap { 214fn analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> DynMap {
215 _analyze_container(db, src).unwrap_or_default() 215 return child_by_source(db, src).unwrap_or_default();
216}
217 216
218fn _analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<DynMap> { 217 fn child_by_source(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<DynMap> {
219 for container in src.value.ancestors().skip(1) { 218 for container in src.value.ancestors().skip(1) {
220 let res = match_ast! { 219 let res = match_ast! {
221 match container { 220 match container {
222 ast::TraitDef(it) => { 221 ast::TraitDef(it) => {
223 let def = Trait::from_source(db, src.with_value(it))?; 222 let def = Trait::from_source(db, src.with_value(it))?;
224 def.id.child_by_source(db) 223 def.id.child_by_source(db)
225 }, 224 },
226 ast::ImplBlock(it) => { 225 ast::ImplBlock(it) => {
227 let def = ImplBlock::from_source(db, src.with_value(it))?; 226 let def = ImplBlock::from_source(db, src.with_value(it))?;
228 def.id.child_by_source(db) 227 def.id.child_by_source(db)
229 }, 228 },
230 ast::FnDef(it) => { 229 ast::FnDef(it) => {
231 let def = Function::from_source(db, src.with_value(it))?; 230 let def = Function::from_source(db, src.with_value(it))?;
232 DefWithBodyId::from(def.id) 231 DefWithBodyId::from(def.id)
233 .child_by_source(db) 232 .child_by_source(db)
234 }, 233 },
235 ast::StaticDef(it) => { 234 ast::StaticDef(it) => {
236 let def = Static::from_source(db, src.with_value(it))?; 235 let def = Static::from_source(db, src.with_value(it))?;
237 DefWithBodyId::from(def.id) 236 DefWithBodyId::from(def.id)
238 .child_by_source(db) 237 .child_by_source(db)
239 }, 238 },
240 ast::ConstDef(it) => { 239 ast::ConstDef(it) => {
241 let def = Const::from_source(db, src.with_value(it))?; 240 let def = Const::from_source(db, src.with_value(it))?;
242 DefWithBodyId::from(def.id) 241 DefWithBodyId::from(def.id)
243 .child_by_source(db) 242 .child_by_source(db)
244 }, 243 },
245 _ => { continue }, 244 _ => { continue },
246 } 245 }
247 }; 246 };
248 return Some(res); 247 return Some(res);
249 } 248 }
250 249
251 let module_source = ModuleSource::from_child_node(db, src); 250 let module_source = ModuleSource::from_child_node(db, src);
252 let c = Module::from_definition(db, src.with_value(module_source))?; 251 let c = Module::from_definition(db, src.with_value(module_source))?;
253 Some(c.id.child_by_source(db)) 252 Some(c.id.child_by_source(db))
253 }
254} 254}