rename source_file -> parse
This commit is contained in:
@@ -43,7 +43,7 @@ pub fn module_from_declaration(
|
||||
|
||||
/// Locates the module by position in the source code.
|
||||
pub fn module_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Module> {
|
||||
let file = db.source_file(position.file_id);
|
||||
let file = db.parse(position.file_id);
|
||||
match find_node_at_offset::<ast::Module>(file.syntax(), position.offset) {
|
||||
Some(m) if !m.has_semi() => module_from_inline(db, position.file_id.into(), m),
|
||||
_ => module_from_file_id(db, position.file_id.into()),
|
||||
@@ -95,7 +95,7 @@ fn module_from_source(db: &impl HirDatabase, source: SourceItemId) -> Option<Mod
|
||||
}
|
||||
|
||||
pub fn function_from_position(db: &impl HirDatabase, position: FilePosition) -> Option<Function> {
|
||||
let file = db.source_file(position.file_id);
|
||||
let file = db.parse(position.file_id);
|
||||
let fn_def = find_node_at_offset::<ast::FnDef>(file.syntax(), position.offset)?;
|
||||
function_from_source(db, position.file_id, fn_def)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user