// ```
pub(crate) fn move_from_mod_rs(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
let source_file = ctx.find_node_at_offset::<ast::SourceFile>()?;
- let module = ctx.sema.to_module_def(ctx.frange.file_id)?;
+ let module = ctx.sema.to_module_def(ctx.file_id())?;
// Enable this assist if the user select all "meaningful" content in the source file
- let trimmed_selected_range = trimmed_text_range(&source_file, ctx.frange.range);
+ let trimmed_selected_range = trimmed_text_range(&source_file, ctx.selection_trimmed());
let trimmed_file_range = trimmed_text_range(&source_file, source_file.syntax().text_range());
if !module.is_mod_rs(ctx.db()) {
cov_mark::hit!(not_mod_rs);
let target = source_file.syntax().text_range();
let module_name = module.name(ctx.db())?.to_string();
let path = format!("../{}.rs", module_name);
- let dst = AnchoredPathBuf { anchor: ctx.frange.file_id, path };
+ let dst = AnchoredPathBuf { anchor: ctx.file_id(), path };
acc.add(
AssistId("move_from_mod_rs", AssistKind::Refactor),
format!("Convert {}/mod.rs to {}.rs", module_name, module_name),
target,
|builder| {
- builder.move_file(ctx.frange.file_id, dst);
+ builder.move_file(ctx.file_id(), dst);
},
)
}