Rename source_edit to source_file_edit to match file_system_edit

This commit is contained in:
Ville Penttinen 2019-03-25 09:13:58 +02:00
parent b92fcbc956
commit 4d26bae46d
5 changed files with 11 additions and 11 deletions

View File

@ -17,7 +17,7 @@ pub(crate) fn assists(db: &RootDatabase, frange: FileRange) -> Vec<Assist> {
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 }

View File

@ -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 },
)),

View File

@ -115,7 +115,7 @@ impl SourceChange {
/// Creates a new SourceChange with the given label,
/// containing only the given `SourceFileEdits`.
pub(crate) fn source_edits<L: Into<String>>(label: L, edits: Vec<SourceFileEdit>) -> Self {
pub(crate) fn source_file_edits<L: Into<String>>(label: L, edits: Vec<SourceFileEdit>) -> 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<L: Into<String>>(label: L, edit: SourceFileEdit) -> Self {
SourceChange::source_edits(label, vec![edit])
pub(crate) fn source_file_edit<L: Into<String>>(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<SourceChange> {
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 },
))

View File

@ -206,7 +206,7 @@ fn rename_reference(
return None;
}
Some(SourceChange::source_edits("rename", edit))
Some(SourceChange::source_file_edits("rename", edit))
}
#[cfg(test)]

View File

@ -33,7 +33,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour
edit.insert(position.offset, inserted);
Some(
SourceChange::source_edit(
SourceChange::source_file_edit(
"on enter",
SourceFileEdit { edit: edit.finish(), file_id: position.file_id },
)