mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
envapsulate navigation target better
This commit is contained in:
parent
1d3d05d5d7
commit
f9ed8d4d23
8 changed files with 102 additions and 96 deletions
|
@ -88,11 +88,11 @@ fn doc_text_for(db: &RootDatabase, nav: NavigationTarget) -> Cancelable<Option<S
|
|||
|
||||
impl NavigationTarget {
|
||||
fn node(&self, db: &RootDatabase) -> Option<TreePtr<SyntaxNode>> {
|
||||
let source_file = db.source_file(self.file_id);
|
||||
let source_file = db.source_file(self.file_id());
|
||||
let source_file = source_file.syntax();
|
||||
let node = source_file
|
||||
.descendants()
|
||||
.find(|node| node.kind() == self.kind && node.range() == self.range)?
|
||||
.find(|node| node.kind() == self.kind() && node.range() == self.range())?
|
||||
.to_owned();
|
||||
Some(node)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue