mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Group file source edits by FileId
This commit is contained in:
parent
f88f3d6885
commit
f51457a643
15 changed files with 188 additions and 180 deletions
|
@ -15,8 +15,11 @@
|
|||
|
||||
mod on_enter;
|
||||
|
||||
use ide_db::base_db::{FilePosition, SourceDatabase};
|
||||
use ide_db::{source_change::SourceFileEdit, RootDatabase};
|
||||
use ide_db::{
|
||||
base_db::{FilePosition, SourceDatabase},
|
||||
source_change::SourceFileEdits,
|
||||
RootDatabase,
|
||||
};
|
||||
use syntax::{
|
||||
algo::find_node_at_offset,
|
||||
ast::{self, edit::IndentLevel, AstToken},
|
||||
|
@ -56,7 +59,7 @@ pub(crate) fn on_char_typed(
|
|||
let file = &db.parse(position.file_id).tree();
|
||||
assert_eq!(file.syntax().text().char_at(position.offset), Some(char_typed));
|
||||
let edit = on_char_typed_inner(file, position.offset, char_typed)?;
|
||||
Some(SourceFileEdit { file_id: position.file_id, edit }.into())
|
||||
Some(SourceFileEdits::from_text_edit(position.file_id, edit).into())
|
||||
}
|
||||
|
||||
fn on_char_typed_inner(file: &SourceFile, offset: TextSize, char_typed: char) -> Option<TextEdit> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue