aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-08 19:30:32 +0000
committerAleksey Kladov <[email protected]>2019-01-08 19:30:32 +0000
commitfa3c9ce3921b6a3f67222bf4f9b4efdf4f11c2a5 (patch)
tree7c31b3941d011c475141e92104464ec4cced6ad8 /crates/ra_analysis/src
parent1967884d6836219ee78a754ca5c66ac781351559 (diff)
fix usages after rename
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r--crates/ra_analysis/src/extend_selection.rs4
-rw-r--r--crates/ra_analysis/src/imp.rs4
-rw-r--r--crates/ra_analysis/src/lib.rs21
-rw-r--r--crates/ra_analysis/src/syntax_highlighting.rs7
4 files changed, 19 insertions, 17 deletions
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
14 if let Some(range) = extend_selection_in_macro(db, &source_file, frange) { 14 if let Some(range) = extend_selection_in_macro(db, &source_file, frange) {
15 return range; 15 return range;
16 } 16 }
17 ra_editor::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range) 17 ra_ide_api_light::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range)
18} 18}
19 19
20fn extend_selection_in_macro( 20fn extend_selection_in_macro(
@@ -25,7 +25,7 @@ fn extend_selection_in_macro(
25 let macro_call = find_macro_call(source_file.syntax(), frange.range)?; 25 let macro_call = find_macro_call(source_file.syntax(), frange.range)?;
26 let (off, exp) = hir::MacroDef::ast_expand(macro_call)?; 26 let (off, exp) = hir::MacroDef::ast_expand(macro_call)?;
27 let dst_range = exp.map_range_forward(frange.range - off)?; 27 let dst_range = exp.map_range_forward(frange.range - off)?;
28 let dst_range = ra_editor::extend_selection(&exp.syntax(), dst_range)?; 28 let dst_range = ra_ide_api_light::extend_selection(&exp.syntax(), dst_range)?;
29 let src_range = exp.map_range_back(dst_range)? + off; 29 let src_range = exp.map_range_back(dst_range)? + off;
30 Some(src_range) 30 Some(src_range)
31} 31}
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::{
6 self, Problem, source_binder, 6 self, Problem, source_binder,
7}; 7};
8use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; 8use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase};
9use ra_editor::{self, assists, LocalEdit, Severity}; 9use ra_ide_api_light::{self, assists, LocalEdit, Severity};
10use ra_syntax::{ 10use ra_syntax::{
11 TextRange, AstNode, SourceFile, 11 TextRange, AstNode, SourceFile,
12 ast::{self, NameOwner}, 12 ast::{self, NameOwner},
@@ -194,7 +194,7 @@ impl db::RootDatabase {
194 pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 194 pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
195 let syntax = self.source_file(file_id); 195 let syntax = self.source_file(file_id);
196 196
197 let mut res = ra_editor::diagnostics(&syntax) 197 let mut res = ra_ide_api_light::diagnostics(&syntax)
198 .into_iter() 198 .into_iter()
199 .map(|d| Diagnostic { 199 .map(|d| Diagnostic {
200 range: d.range, 200 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::{
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>> {
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 @@
1use ra_syntax::{ast, AstNode,}; 1use ra_syntax::{ast, AstNode,};
2use ra_editor::HighlightedRange;
3use ra_db::SyntaxDatabase; 2use ra_db::SyntaxDatabase;
4 3
5use crate::{ 4use crate::{
5 FileId, Cancelable, HighlightedRange,
6 db::RootDatabase, 6 db::RootDatabase,
7 FileId, Cancelable,
8}; 7};
9 8
10pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> { 9pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
11 let source_file = db.source_file(file_id); 10 let source_file = db.source_file(file_id);
12 let mut res = ra_editor::highlight(source_file.syntax()); 11 let mut res = ra_ide_api_light::highlight(source_file.syntax());
13 for macro_call in source_file 12 for macro_call in source_file
14 .syntax() 13 .syntax()
15 .descendants() 14 .descendants()
16 .filter_map(ast::MacroCall::cast) 15 .filter_map(ast::MacroCall::cast)
17 { 16 {
18 if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) { 17 if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) {
19 let mapped_ranges = ra_editor::highlight(&exp.syntax()) 18 let mapped_ranges = ra_ide_api_light::highlight(&exp.syntax())
20 .into_iter() 19 .into_iter()
21 .filter_map(|r| { 20 .filter_map(|r| {
22 let mapped_range = exp.map_range_back(r.range)?; 21 let mapped_range = exp.map_range_back(r.range)?;