Use the new Resolver API for goto def

This commit is contained in:
Florian Diebold 2019-01-29 20:49:31 +01:00
parent 33ff7b56ff
commit afce8e4426
6 changed files with 89 additions and 35 deletions

View file

@ -1,9 +1,9 @@
use ra_db::FileId;
use ra_syntax::{
SyntaxNode, AstNode, SmolStr, TextRange, ast,
SyntaxNode, SyntaxNodePtr, AstNode, SmolStr, TextRange, ast,
SyntaxKind::{self, NAME},
};
use hir::{ModuleSource, FieldSource};
use hir::{ModuleSource, FieldSource, Name};
use crate::{FileSymbol, db::RootDatabase};
@ -58,12 +58,13 @@ impl NavigationTarget {
pub(crate) fn from_scope_entry(
file_id: FileId,
entry: &hir::ScopeEntryWithSyntax,
name: Name,
ptr: SyntaxNodePtr,
) -> NavigationTarget {
NavigationTarget {
file_id,
name: entry.name().to_string().into(),
full_range: entry.ptr().range(),
name: name.to_string().into(),
full_range: ptr.range(),
focus_range: None,
kind: NAME,
}