From fa3c9ce3921b6a3f67222bf4f9b4efdf4f11c2a5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Jan 2019 22:30:32 +0300 Subject: fix usages after rename --- crates/ra_analysis/src/extend_selection.rs | 4 ++-- crates/ra_analysis/src/imp.rs | 4 ++-- crates/ra_analysis/src/lib.rs | 21 ++++++++++++--------- crates/ra_analysis/src/syntax_highlighting.rs | 7 +++---- 4 files changed, 19 insertions(+), 17 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/extend_selection.rs b/crates/ra_analysis/src/extend_selection.rs index 3b130f966..c3c809c9f 100644 --- a/crates/ra_analysis/src/extend_selection.rs +++ b/crates/ra_analysis/src/extend_selection.rs @@ -14,7 +14,7 @@ pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRang if let Some(range) = extend_selection_in_macro(db, &source_file, frange) { return range; } - ra_editor::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range) + ra_ide_api_light::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range) } fn extend_selection_in_macro( @@ -25,7 +25,7 @@ fn extend_selection_in_macro( let macro_call = find_macro_call(source_file.syntax(), frange.range)?; let (off, exp) = hir::MacroDef::ast_expand(macro_call)?; let dst_range = exp.map_range_forward(frange.range - off)?; - let dst_range = ra_editor::extend_selection(&exp.syntax(), dst_range)?; + let dst_range = ra_ide_api_light::extend_selection(&exp.syntax(), dst_range)?; let src_range = exp.map_range_back(dst_range)? + off; Some(src_range) } diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 2b9963b3c..7c60ab7d6 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -6,7 +6,7 @@ use hir::{ self, Problem, source_binder, }; use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; -use ra_editor::{self, assists, LocalEdit, Severity}; +use ra_ide_api_light::{self, assists, LocalEdit, Severity}; use ra_syntax::{ TextRange, AstNode, SourceFile, ast::{self, NameOwner}, @@ -194,7 +194,7 @@ impl db::RootDatabase { pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable> { let syntax = self.source_file(file_id); - let mut res = ra_editor::diagnostics(&syntax) + let mut res = ra_ide_api_light::diagnostics(&syntax) .into_iter() .map(|d| Diagnostic { range: d.range, diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 48df08416..183e36706 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -44,7 +44,7 @@ pub use crate::{ completion::{CompletionItem, CompletionItemKind, InsertText}, runnables::{Runnable, RunnableKind}, }; -pub use ra_editor::{ +pub use ra_ide_api_light::{ Fold, FoldKind, HighlightedRange, Severity, StructureNode, LineIndex, LineCol, translate_offset_with_edit, }; @@ -336,25 +336,28 @@ impl Analysis { /// Returns position of the mathcing brace (all types of braces are /// supported). pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option { - ra_editor::matching_brace(file, offset) + ra_ide_api_light::matching_brace(file, offset) } /// Returns a syntax tree represented as `String`, for debug purposes. // FIXME: use a better name here. pub fn syntax_tree(&self, file_id: FileId) -> String { let file = self.db.source_file(file_id); - ra_editor::syntax_tree(&file) + ra_ide_api_light::syntax_tree(&file) } /// Returns an edit to remove all newlines in the range, cleaning up minor /// stuff like trailing commas. pub fn join_lines(&self, frange: FileRange) -> SourceChange { let file = self.db.source_file(frange.file_id); - SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range)) + SourceChange::from_local_edit( + frange.file_id, + ra_ide_api_light::join_lines(&file, frange.range), + ) } /// Returns an edit which should be applied when opening a new line, fixing /// up minor stuff like continuing the comment. pub fn on_enter(&self, position: FilePosition) -> Option { let file = self.db.source_file(position.file_id); - let edit = ra_editor::on_enter(&file, position.offset)?; + let edit = ra_ide_api_light::on_enter(&file, position.offset)?; Some(SourceChange::from_local_edit(position.file_id, edit)) } /// Returns an edit which should be applied after `=` was typed. Primarily, @@ -362,25 +365,25 @@ impl Analysis { // FIXME: use a snippet completion instead of this hack here. pub fn on_eq_typed(&self, position: FilePosition) -> Option { let file = self.db.source_file(position.file_id); - let edit = ra_editor::on_eq_typed(&file, position.offset)?; + let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?; Some(SourceChange::from_local_edit(position.file_id, edit)) } /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately. pub fn on_dot_typed(&self, position: FilePosition) -> Option { let file = self.db.source_file(position.file_id); - let edit = ra_editor::on_dot_typed(&file, position.offset)?; + let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?; Some(SourceChange::from_local_edit(position.file_id, edit)) } /// Returns a tree representation of symbols in the file. Useful to draw a /// file outline. pub fn file_structure(&self, file_id: FileId) -> Vec { let file = self.db.source_file(file_id); - ra_editor::file_structure(&file) + ra_ide_api_light::file_structure(&file) } /// Returns the set of folding ranges. pub fn folding_ranges(&self, file_id: FileId) -> Vec { let file = self.db.source_file(file_id); - ra_editor::folding_ranges(&file) + ra_ide_api_light::folding_ranges(&file) } /// Fuzzy searches for a symbol. pub fn symbol_search(&self, query: Query) -> Cancelable> { diff --git a/crates/ra_analysis/src/syntax_highlighting.rs b/crates/ra_analysis/src/syntax_highlighting.rs index d2dc6cfbb..cb19e9515 100644 --- a/crates/ra_analysis/src/syntax_highlighting.rs +++ b/crates/ra_analysis/src/syntax_highlighting.rs @@ -1,22 +1,21 @@ use ra_syntax::{ast, AstNode,}; -use ra_editor::HighlightedRange; use ra_db::SyntaxDatabase; use crate::{ + FileId, Cancelable, HighlightedRange, db::RootDatabase, - FileId, Cancelable, }; pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable> { let source_file = db.source_file(file_id); - let mut res = ra_editor::highlight(source_file.syntax()); + let mut res = ra_ide_api_light::highlight(source_file.syntax()); for macro_call in source_file .syntax() .descendants() .filter_map(ast::MacroCall::cast) { if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) { - let mapped_ranges = ra_editor::highlight(&exp.syntax()) + let mapped_ranges = ra_ide_api_light::highlight(&exp.syntax()) .into_iter() .filter_map(|r| { let mapped_range = exp.map_range_back(r.range)?; -- cgit v1.2.3