From 4d26bae46db1e4d7a72f9808e7d19ea11fd3bd7d Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Mon, 25 Mar 2019 09:13:58 +0200 Subject: Rename source_edit to source_file_edit to match file_system_edit --- crates/ra_ide_api/src/assists.rs | 2 +- crates/ra_ide_api/src/diagnostics.rs | 4 ++-- crates/ra_ide_api/src/lib.rs | 12 ++++++------ crates/ra_ide_api/src/references.rs | 2 +- crates/ra_ide_api/src/typing.rs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/ra_ide_api/src/assists.rs b/crates/ra_ide_api/src/assists.rs index 9a8c23a15..355c0a42a 100644 --- a/crates/ra_ide_api/src/assists.rs +++ b/crates/ra_ide_api/src/assists.rs @@ -17,7 +17,7 @@ pub(crate) fn assists(db: &RootDatabase, frange: FileRange) -> Vec { let file_id = frange.file_id; let file_edit = SourceFileEdit { file_id, edit: action.edit }; let id = label.id; - let change = SourceChange::source_edit(label.label, file_edit).with_cursor_opt( + let change = SourceChange::source_file_edit(label.label, file_edit).with_cursor_opt( action.cursor_position.map(|offset| FilePosition { offset, file_id }), ); Assist { id, change } diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 6559de29d..156f28ca3 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -71,7 +71,7 @@ fn check_unnecessary_braces_in_use_statement( range, message: format!("Unnecessary braces in use statement"), severity: Severity::WeakWarning, - fix: Some(SourceChange::source_edit( + fix: Some(SourceChange::source_file_edit( "Remove unnecessary braces", SourceFileEdit { file_id, edit }, )), @@ -117,7 +117,7 @@ fn check_struct_shorthand_initialization( range: named_field.syntax().range(), message: format!("Shorthand struct initialization"), severity: Severity::WeakWarning, - fix: Some(SourceChange::source_edit( + fix: Some(SourceChange::source_file_edit( "use struct shorthand initialization", SourceFileEdit { file_id, edit }, )), diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 928f3d604..8aa3eb088 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -115,7 +115,7 @@ impl SourceChange { /// Creates a new SourceChange with the given label, /// containing only the given `SourceFileEdits`. - pub(crate) fn source_edits>(label: L, edits: Vec) -> Self { + pub(crate) fn source_file_edits>(label: L, edits: Vec) -> Self { SourceChange { label: label.into(), source_file_edits: edits, @@ -137,8 +137,8 @@ impl SourceChange { /// Creates a new SourceChange with the given label, /// containing only a single `SourceFileEdit`. - pub(crate) fn source_edit>(label: L, edit: SourceFileEdit) -> Self { - SourceChange::source_edits(label, vec![edit]) + pub(crate) fn source_file_edit>(label: L, edit: SourceFileEdit) -> Self { + SourceChange::source_file_edits(label, vec![edit]) } /// Creates a new SourceChange with the given label @@ -148,7 +148,7 @@ impl SourceChange { file_id: FileId, edit: TextEdit, ) -> Self { - SourceChange::source_edit(label, SourceFileEdit { file_id, edit }) + SourceChange::source_file_edit(label, SourceFileEdit { file_id, edit }) } /// Creates a new SourceChange with the given label @@ -358,7 +358,7 @@ impl Analysis { file_id: frange.file_id, edit: join_lines::join_lines(&file, frange.range), }; - SourceChange::source_edit("join lines", file_edit) + SourceChange::source_file_edit("join lines", file_edit) } /// Returns an edit which should be applied when opening a new line, fixing @@ -373,7 +373,7 @@ impl Analysis { pub fn on_eq_typed(&self, position: FilePosition) -> Option { let file = self.db.parse(position.file_id); let edit = typing::on_eq_typed(&file, position.offset)?; - Some(SourceChange::source_edit( + Some(SourceChange::source_file_edit( "add semicolon", SourceFileEdit { edit, file_id: position.file_id }, )) diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index 78f77e761..22741445a 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs @@ -206,7 +206,7 @@ fn rename_reference( return None; } - Some(SourceChange::source_edits("rename", edit)) + Some(SourceChange::source_file_edits("rename", edit)) } #[cfg(test)] diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs index aa9971450..501d44dbb 100644 --- a/crates/ra_ide_api/src/typing.rs +++ b/crates/ra_ide_api/src/typing.rs @@ -33,7 +33,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option