aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libanalysis/src')
-rw-r--r--crates/libanalysis/src/api.rs16
-rw-r--r--crates/libanalysis/src/imp.rs20
2 files changed, 18 insertions, 18 deletions
diff --git a/crates/libanalysis/src/api.rs b/crates/libanalysis/src/api.rs
index 6c06e0b32..02eaf7b1c 100644
--- a/crates/libanalysis/src/api.rs
+++ b/crates/libanalysis/src/api.rs
@@ -109,19 +109,3 @@ impl Analysis {
109 self.imp.diagnostics(file_id) 109 self.imp.diagnostics(file_id)
110 } 110 }
111} 111}
112
113impl SourceChange {
114 pub(crate) fn from_local_edit(file_id: FileId, label: &str, edit: LocalEdit) -> SourceChange {
115 let file_edit = SourceFileEdit {
116 file_id,
117 edits: edit.edit.into_atoms(),
118 };
119 SourceChange {
120 label: label.to_string(),
121 source_file_edits: vec![file_edit],
122 file_system_edits: vec![],
123 cursor_position: edit.cursor_position
124 .map(|offset| Position { offset, file_id })
125 }
126 }
127}
diff --git a/crates/libanalysis/src/imp.rs b/crates/libanalysis/src/imp.rs
index 76f0c0c87..5f451f53f 100644
--- a/crates/libanalysis/src/imp.rs
+++ b/crates/libanalysis/src/imp.rs
@@ -16,10 +16,10 @@ use libsyntax2::{
16}; 16};
17use rayon::prelude::*; 17use rayon::prelude::*;
18use once_cell::sync::OnceCell; 18use once_cell::sync::OnceCell;
19use libeditor::{self, FileSymbol, LineIndex, find_node_at_offset}; 19use libeditor::{self, FileSymbol, LineIndex, find_node_at_offset, LocalEdit};
20 20
21use { 21use {
22 FileId, FileResolver, Query, Diagnostic, SourceChange, FileSystemEdit, 22 FileId, FileResolver, Query, Diagnostic, SourceChange, SourceFileEdit, Position, FileSystemEdit,
23 module_map::Problem, 23 module_map::Problem,
24 symbol_index::FileSymbols, 24 symbol_index::FileSymbols,
25 module_map::ModuleMap, 25 module_map::ModuleMap,
@@ -289,3 +289,19 @@ impl FileData {
289 .get_or_init(|| FileSymbols::new(&syntax)) 289 .get_or_init(|| FileSymbols::new(&syntax))
290 } 290 }
291} 291}
292
293impl SourceChange {
294 pub(crate) fn from_local_edit(file_id: FileId, label: &str, edit: LocalEdit) -> SourceChange {
295 let file_edit = SourceFileEdit {
296 file_id,
297 edits: edit.edit.into_atoms(),
298 };
299 SourceChange {
300 label: label.to_string(),
301 source_file_edits: vec![file_edit],
302 file_system_edits: vec![],
303 cursor_position: edit.cursor_position
304 .map(|offset| Position { offset, file_id })
305 }
306 }
307}