From 0d6d74e78ecb6d110de751c528e662fc61113e78 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Aug 2018 12:34:31 +0300 Subject: minor --- crates/libanalysis/src/api.rs | 16 ---------------- crates/libanalysis/src/imp.rs | 20 ++++++++++++++++++-- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'crates') 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 { 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 }) - } - } -} 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::{ }; 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 }) + } + } +} -- cgit v1.2.3