aboutsummaryrefslogtreecommitdiff
path: root/crates
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
parent1967884d6836219ee78a754ca5c66ac781351559 (diff)
fix usages after rename
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_analysis/Cargo.toml2
-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
-rw-r--r--crates/ra_cli/Cargo.toml2
-rw-r--r--crates/ra_cli/src/main.rs2
-rw-r--r--crates/ra_ide_api_light/Cargo.toml2
-rw-r--r--crates/ra_ide_api_light/src/lib.rs5
9 files changed, 28 insertions, 21 deletions
diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml
index 11c78ced8..3c0814279 100644
--- a/crates/ra_analysis/Cargo.toml
+++ b/crates/ra_analysis/Cargo.toml
@@ -16,7 +16,7 @@ parking_lot = "0.7.0"
16unicase = "2.2.0" 16unicase = "2.2.0"
17 17
18ra_syntax = { path = "../ra_syntax" } 18ra_syntax = { path = "../ra_syntax" }
19ra_editor = { path = "../ra_editor" } 19ra_ide_api_light = { path = "../ra_ide_api_light" }
20ra_text_edit = { path = "../ra_text_edit" } 20ra_text_edit = { path = "../ra_text_edit" }
21ra_db = { path = "../ra_db" } 21ra_db = { path = "../ra_db" }
22hir = { path = "../ra_hir", package = "ra_hir" } 22hir = { path = "../ra_hir", package = "ra_hir" }
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)?;
diff --git a/crates/ra_cli/Cargo.toml b/crates/ra_cli/Cargo.toml
index 83f1d91e0..eb1722d5e 100644
--- a/crates/ra_cli/Cargo.toml
+++ b/crates/ra_cli/Cargo.toml
@@ -10,5 +10,5 @@ clap = "2.32.0"
10failure = "0.1.4" 10failure = "0.1.4"
11join_to_string = "0.1.1" 11join_to_string = "0.1.1"
12ra_syntax = { path = "../ra_syntax" } 12ra_syntax = { path = "../ra_syntax" }
13ra_editor = { path = "../ra_editor" } 13ra_ide_api_light = { path = "../ra_ide_api_light" }
14tools = { path = "../tools" } 14tools = { path = "../tools" }
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index 0d12f3a88..43fb2fc4c 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -2,7 +2,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
2 2
3use clap::{App, Arg, SubCommand}; 3use clap::{App, Arg, SubCommand};
4use join_to_string::join; 4use join_to_string::join;
5use ra_editor::{extend_selection, file_structure, syntax_tree}; 5use ra_ide_api_light::{extend_selection, file_structure, syntax_tree};
6use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode}; 6use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode};
7use tools::collect_tests; 7use tools::collect_tests;
8 8
diff --git a/crates/ra_ide_api_light/Cargo.toml b/crates/ra_ide_api_light/Cargo.toml
index a97d2308f..8c192fca6 100644
--- a/crates/ra_ide_api_light/Cargo.toml
+++ b/crates/ra_ide_api_light/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2edition = "2018" 2edition = "2018"
3name = "ra_editor" 3name = "ra_ide_api_light"
4version = "0.1.0" 4version = "0.1.0"
5authors = ["Aleksey Kladov <[email protected]>"] 5authors = ["Aleksey Kladov <[email protected]>"]
6publish = false 6publish = false
diff --git a/crates/ra_ide_api_light/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs
index 5a6af19b7..40638eda8 100644
--- a/crates/ra_ide_api_light/src/lib.rs
+++ b/crates/ra_ide_api_light/src/lib.rs
@@ -1,3 +1,8 @@
1//! This crate provides thouse IDE features which use only a single file.
2//!
3//! This usually means functions which take sytnax tree as an input and produce
4//! an edit or some auxilarly info.
5
1pub mod assists; 6pub mod assists;
2mod extend_selection; 7mod extend_selection;
3mod folding_ranges; 8mod folding_ranges;