- let (text_without_caret, file_with_caret_id, range_or_offset, db) = if before.contains("//-") {
- let (mut db, position) = RootDatabase::with_position(before);
- db.set_local_roots(Arc::new(vec![db.file_source_root(position.file_id)]));
- (
- db.file_text(position.file_id).as_ref().to_owned(),
- position.file_id,
- RangeOrOffset::Offset(position.offset),
- db,
- )
- } else {
- let (range_or_offset, text_without_caret) = extract_range_or_offset(before);
- let (db, file_id) = with_single_file(&text_without_caret);
- (text_without_caret, file_id, range_or_offset, db)
- };
+ let (db, file_with_caret_id, range_or_offset) = RootDatabase::with_range_or_offset(before);
+ let text_without_caret = db.file_text(file_with_caret_id).as_ref().to_owned();