From 16c740526233b01980efdbb680b55718a71bb0e1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 14 May 2019 01:42:59 +0300 Subject: expand to syntax node --- crates/ra_hir/src/diagnostics.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir/src/diagnostics.rs') diff --git a/crates/ra_hir/src/diagnostics.rs b/crates/ra_hir/src/diagnostics.rs index d41525779..4b7b2dbee 100644 --- a/crates/ra_hir/src/diagnostics.rs +++ b/crates/ra_hir/src/diagnostics.rs @@ -1,6 +1,6 @@ use std::{fmt, any::Any}; -use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode, AstNode}; +use ra_syntax::{SyntaxNodePtr, TreeArc, AstPtr, TextRange, ast, SyntaxNode}; use relative_path::RelativePathBuf; use crate::{HirFileId, HirDatabase, Name}; @@ -29,8 +29,8 @@ pub trait Diagnostic: Any + Send + Sync + fmt::Debug + 'static { impl dyn Diagnostic { pub fn syntax_node(&self, db: &impl HirDatabase) -> TreeArc { - let source_file = db.hir_parse(self.file()); - self.syntax_node_ptr().to_node(source_file.syntax()).to_owned() + let node = db.parse_or_expand(self.file()).unwrap(); + self.syntax_node_ptr().to_node(&*node).to_owned() } pub fn downcast_ref(&self) -> Option<&D> { self.as_any().downcast_ref() -- cgit v1.2.3