use Semantics::parse_or_expand in another place

This commit is contained in:
Jake Heinz 2021-11-27 11:55:03 +00:00
parent a69af9daa3
commit a1030b07ab

View File

@ -4,8 +4,8 @@ use std::fmt;
use either::Either; use either::Either;
use hir::{ use hir::{
db::AstDatabase, AssocItem, Documentation, FieldSource, HasAttrs, HasSource, HirDisplay, AssocItem, Documentation, FieldSource, HasAttrs, HasSource, HirDisplay, InFile, ModuleSource,
InFile, ModuleSource, Semantics, Semantics,
}; };
use ide_db::{ use ide_db::{
base_db::{FileId, FileRange}, base_db::{FileId, FileRange},
@ -517,7 +517,7 @@ impl TryToNav for hir::ConstParam {
/// e.g. `struct Name`, `enum Name`, `fn Name` /// e.g. `struct Name`, `enum Name`, `fn Name`
pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> { pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
let sema = Semantics::new(db); let sema = Semantics::new(db);
let syntax = sema.db.parse_or_expand(symbol.file_id)?; let syntax = sema.parse_or_expand(symbol.file_id)?;
let node = symbol.ptr.to_node(&syntax); let node = symbol.ptr.to_node(&syntax);
match_ast! { match_ast! {