mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
minor
This commit is contained in:
parent
7d95d38ecb
commit
0d6d74e78e
2 changed files with 18 additions and 18 deletions
|
@ -109,19 +109,3 @@ impl Analysis {
|
|||
self.imp.diagnostics(file_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceChange {
|
||||
pub(crate) fn from_local_edit(file_id: FileId, label: &str, edit: LocalEdit) -> SourceChange {
|
||||
let file_edit = SourceFileEdit {
|
||||
file_id,
|
||||
edits: edit.edit.into_atoms(),
|
||||
};
|
||||
SourceChange {
|
||||
label: label.to_string(),
|
||||
source_file_edits: vec![file_edit],
|
||||
file_system_edits: vec![],
|
||||
cursor_position: edit.cursor_position
|
||||
.map(|offset| Position { offset, file_id })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ use libsyntax2::{
|
|||
};
|
||||
use rayon::prelude::*;
|
||||
use once_cell::sync::OnceCell;
|
||||
use libeditor::{self, FileSymbol, LineIndex, find_node_at_offset};
|
||||
use libeditor::{self, FileSymbol, LineIndex, find_node_at_offset, LocalEdit};
|
||||
|
||||
use {
|
||||
FileId, FileResolver, Query, Diagnostic, SourceChange, FileSystemEdit,
|
||||
FileId, FileResolver, Query, Diagnostic, SourceChange, SourceFileEdit, Position, FileSystemEdit,
|
||||
module_map::Problem,
|
||||
symbol_index::FileSymbols,
|
||||
module_map::ModuleMap,
|
||||
|
@ -289,3 +289,19 @@ impl FileData {
|
|||
.get_or_init(|| FileSymbols::new(&syntax))
|
||||
}
|
||||
}
|
||||
|
||||
impl SourceChange {
|
||||
pub(crate) fn from_local_edit(file_id: FileId, label: &str, edit: LocalEdit) -> SourceChange {
|
||||
let file_edit = SourceFileEdit {
|
||||
file_id,
|
||||
edits: edit.edit.into_atoms(),
|
||||
};
|
||||
SourceChange {
|
||||
label: label.to_string(),
|
||||
source_file_edits: vec![file_edit],
|
||||
file_system_edits: vec![],
|
||||
cursor_position: edit.cursor_position
|
||||
.map(|offset| Position { offset, file_id })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue