aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r--crates/ra_analysis/src/lib.rs21
1 files changed, 12 insertions, 9 deletions
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::{
44 completion::{CompletionItem, CompletionItemKind, InsertText}, 44 completion::{CompletionItem, CompletionItemKind, InsertText},
45 runnables::{Runnable, RunnableKind}, 45 runnables::{Runnable, RunnableKind},
46}; 46};
47pub use ra_editor::{ 47pub use ra_ide_api_light::{
48 Fold, FoldKind, HighlightedRange, Severity, StructureNode, 48 Fold, FoldKind, HighlightedRange, Severity, StructureNode,
49 LineIndex, LineCol, translate_offset_with_edit, 49 LineIndex, LineCol, translate_offset_with_edit,
50}; 50};
@@ -336,25 +336,28 @@ impl Analysis {
336 /// Returns position of the mathcing brace (all types of braces are 336 /// Returns position of the mathcing brace (all types of braces are
337 /// supported). 337 /// supported).
338 pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> { 338 pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> {
339 ra_editor::matching_brace(file, offset) 339 ra_ide_api_light::matching_brace(file, offset)
340 } 340 }
341 /// Returns a syntax tree represented as `String`, for debug purposes. 341 /// Returns a syntax tree represented as `String`, for debug purposes.
342 // FIXME: use a better name here. 342 // FIXME: use a better name here.
343 pub fn syntax_tree(&self, file_id: FileId) -> String { 343 pub fn syntax_tree(&self, file_id: FileId) -> String {
344 let file = self.db.source_file(file_id); 344 let file = self.db.source_file(file_id);
345 ra_editor::syntax_tree(&file) 345 ra_ide_api_light::syntax_tree(&file)
346 } 346 }
347 /// Returns an edit to remove all newlines in the range, cleaning up minor 347 /// Returns an edit to remove all newlines in the range, cleaning up minor
348 /// stuff like trailing commas. 348 /// stuff like trailing commas.
349 pub fn join_lines(&self, frange: FileRange) -> SourceChange { 349 pub fn join_lines(&self, frange: FileRange) -> SourceChange {
350 let file = self.db.source_file(frange.file_id); 350 let file = self.db.source_file(frange.file_id);
351 SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range)) 351 SourceChange::from_local_edit(
352 frange.file_id,
353 ra_ide_api_light::join_lines(&file, frange.range),
354 )
352 } 355 }
353 /// Returns an edit which should be applied when opening a new line, fixing 356 /// Returns an edit which should be applied when opening a new line, fixing
354 /// up minor stuff like continuing the comment. 357 /// up minor stuff like continuing the comment.
355 pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> { 358 pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
356 let file = self.db.source_file(position.file_id); 359 let file = self.db.source_file(position.file_id);
357 let edit = ra_editor::on_enter(&file, position.offset)?; 360 let edit = ra_ide_api_light::on_enter(&file, position.offset)?;
358 Some(SourceChange::from_local_edit(position.file_id, edit)) 361 Some(SourceChange::from_local_edit(position.file_id, edit))
359 } 362 }
360 /// Returns an edit which should be applied after `=` was typed. Primarily, 363 /// Returns an edit which should be applied after `=` was typed. Primarily,
@@ -362,25 +365,25 @@ impl Analysis {
362 // FIXME: use a snippet completion instead of this hack here. 365 // FIXME: use a snippet completion instead of this hack here.
363 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { 366 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
364 let file = self.db.source_file(position.file_id); 367 let file = self.db.source_file(position.file_id);
365 let edit = ra_editor::on_eq_typed(&file, position.offset)?; 368 let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?;
366 Some(SourceChange::from_local_edit(position.file_id, edit)) 369 Some(SourceChange::from_local_edit(position.file_id, edit))
367 } 370 }
368 /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately. 371 /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately.
369 pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> { 372 pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> {
370 let file = self.db.source_file(position.file_id); 373 let file = self.db.source_file(position.file_id);
371 let edit = ra_editor::on_dot_typed(&file, position.offset)?; 374 let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?;
372 Some(SourceChange::from_local_edit(position.file_id, edit)) 375 Some(SourceChange::from_local_edit(position.file_id, edit))
373 } 376 }
374 /// Returns a tree representation of symbols in the file. Useful to draw a 377 /// Returns a tree representation of symbols in the file. Useful to draw a
375 /// file outline. 378 /// file outline.
376 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 379 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
377 let file = self.db.source_file(file_id); 380 let file = self.db.source_file(file_id);
378 ra_editor::file_structure(&file) 381 ra_ide_api_light::file_structure(&file)
379 } 382 }
380 /// Returns the set of folding ranges. 383 /// Returns the set of folding ranges.
381 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> { 384 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
382 let file = self.db.source_file(file_id); 385 let file = self.db.source_file(file_id);
383 ra_editor::folding_ranges(&file) 386 ra_ide_api_light::folding_ranges(&file)
384 } 387 }
385 /// Fuzzy searches for a symbol. 388 /// Fuzzy searches for a symbol.
386 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> { 389 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> {