use Source for statics and consts

This commit is contained in:
Aleksey Kladov 2019-06-11 17:13:20 +03:00
parent 4f94af3c4a
commit 46bc8675ed
6 changed files with 41 additions and 56 deletions

View file

@ -126,12 +126,11 @@ impl Completions {
}
pub(crate) fn add_const(&mut self, ctx: &CompletionContext, constant: hir::Const) {
let (_file_id, ast_node) = constant.source(ctx.db);
let ast_node = constant.source(ctx.db).ast;
let name = match ast_node.name() {
Some(name) => name,
_ => return,
};
let (_, ast_node) = constant.source(ctx.db);
let detail = const_label(&ast_node);
CompletionItem::new(CompletionKind::Reference, ctx.source_range(), name.text().to_string())