aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-08 19:48:48 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-08 19:48:48 +0000
commit46f74e33ca53a7897e9020d3de75cc76a6b89d79 (patch)
tree2bc001c8ecf58b49ac9a0da1f20d5644ce29fb3a /crates
parent4f4f7933b1b7ff34f8633b1686b18b2d1b994c47 (diff)
parent0c62b1bb7a49bf527780ce1f8cade5eb4fbfdb2d (diff)
Merge #471
471: rename crates to match reality r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_cli/Cargo.toml2
-rw-r--r--crates/ra_cli/src/main.rs2
-rw-r--r--crates/ra_db/src/lib.rs2
-rw-r--r--crates/ra_ide_api/Cargo.toml (renamed from crates/ra_analysis/Cargo.toml)4
-rw-r--r--crates/ra_ide_api/src/call_info.rs (renamed from crates/ra_analysis/src/call_info.rs)0
-rw-r--r--crates/ra_ide_api/src/completion.rs (renamed from crates/ra_analysis/src/completion.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/complete_dot.rs (renamed from crates/ra_analysis/src/completion/complete_dot.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/complete_fn_param.rs (renamed from crates/ra_analysis/src/completion/complete_fn_param.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/complete_keyword.rs (renamed from crates/ra_analysis/src/completion/complete_keyword.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/complete_path.rs (renamed from crates/ra_analysis/src/completion/complete_path.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs (renamed from crates/ra_analysis/src/completion/complete_scope.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/complete_snippet.rs (renamed from crates/ra_analysis/src/completion/complete_snippet.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs (renamed from crates/ra_analysis/src/completion/completion_context.rs)0
-rw-r--r--crates/ra_ide_api/src/completion/completion_item.rs (renamed from crates/ra_analysis/src/completion/completion_item.rs)0
-rw-r--r--crates/ra_ide_api/src/db.rs (renamed from crates/ra_analysis/src/db.rs)0
-rw-r--r--crates/ra_ide_api/src/extend_selection.rs (renamed from crates/ra_analysis/src/extend_selection.rs)4
-rw-r--r--crates/ra_ide_api/src/goto_defenition.rs (renamed from crates/ra_analysis/src/goto_defenition.rs)0
-rw-r--r--crates/ra_ide_api/src/hover.rs (renamed from crates/ra_analysis/src/hover.rs)0
-rw-r--r--crates/ra_ide_api/src/imp.rs (renamed from crates/ra_analysis/src/imp.rs)4
-rw-r--r--crates/ra_ide_api/src/lib.rs (renamed from crates/ra_analysis/src/lib.rs)31
-rw-r--r--crates/ra_ide_api/src/mock_analysis.rs (renamed from crates/ra_analysis/src/mock_analysis.rs)0
-rw-r--r--crates/ra_ide_api/src/runnables.rs (renamed from crates/ra_analysis/src/runnables.rs)0
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs (renamed from crates/ra_analysis/src/symbol_index.rs)0
-rw-r--r--crates/ra_ide_api/src/syntax_highlighting.rs (renamed from crates/ra_analysis/src/syntax_highlighting.rs)7
-rw-r--r--crates/ra_ide_api/tests/test/main.rs (renamed from crates/ra_analysis/tests/test/main.rs)2
-rw-r--r--crates/ra_ide_api/tests/test/runnables.rs (renamed from crates/ra_analysis/tests/test/runnables.rs)2
-rw-r--r--crates/ra_ide_api_light/Cargo.toml (renamed from crates/ra_editor/Cargo.toml)2
-rw-r--r--crates/ra_ide_api_light/src/assists.rs (renamed from crates/ra_editor/src/assists.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/add_derive.rs (renamed from crates/ra_editor/src/assists/add_derive.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/add_impl.rs (renamed from crates/ra_editor/src/assists/add_impl.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/change_visibility.rs (renamed from crates/ra_editor/src/assists/change_visibility.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/flip_comma.rs (renamed from crates/ra_editor/src/assists/flip_comma.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/introduce_variable.rs (renamed from crates/ra_editor/src/assists/introduce_variable.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs (renamed from crates/ra_editor/src/assists/replace_if_let_with_match.rs)0
-rw-r--r--crates/ra_ide_api_light/src/assists/split_import.rs (renamed from crates/ra_editor/src/assists/split_import.rs)0
-rw-r--r--crates/ra_ide_api_light/src/diagnostics.rs (renamed from crates/ra_editor/src/diagnostics.rs)0
-rw-r--r--crates/ra_ide_api_light/src/extend_selection.rs (renamed from crates/ra_editor/src/extend_selection.rs)0
-rw-r--r--crates/ra_ide_api_light/src/folding_ranges.rs (renamed from crates/ra_editor/src/folding_ranges.rs)0
-rw-r--r--crates/ra_ide_api_light/src/lib.rs (renamed from crates/ra_editor/src/lib.rs)5
-rw-r--r--crates/ra_ide_api_light/src/line_index.rs (renamed from crates/ra_editor/src/line_index.rs)0
-rw-r--r--crates/ra_ide_api_light/src/line_index_utils.rs (renamed from crates/ra_editor/src/line_index_utils.rs)0
-rw-r--r--crates/ra_ide_api_light/src/structure.rs (renamed from crates/ra_editor/src/structure.rs)0
-rw-r--r--crates/ra_ide_api_light/src/test_utils.rs (renamed from crates/ra_editor/src/test_utils.rs)0
-rw-r--r--crates/ra_ide_api_light/src/typing.rs (renamed from crates/ra_editor/src/typing.rs)0
-rw-r--r--crates/ra_lsp_server/Cargo.toml2
-rw-r--r--crates/ra_lsp_server/src/conv.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs4
-rw-r--r--crates/ra_lsp_server/src/main_loop/subscriptions.rs2
-rw-r--r--crates/ra_lsp_server/src/server_world.rs6
50 files changed, 49 insertions, 36 deletions
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_db/src/lib.rs b/crates/ra_db/src/lib.rs
index f56f70983..e680d9fc3 100644
--- a/crates/ra_db/src/lib.rs
+++ b/crates/ra_db/src/lib.rs
@@ -1,4 +1,4 @@
1//! ra_db defines basic database traits. Concrete DB is defined by ra_analysis. 1//! ra_db defines basic database traits. Concrete DB is defined by ra_ide_api.
2mod cancelation; 2mod cancelation;
3mod syntax_ptr; 3mod syntax_ptr;
4mod input; 4mod input;
diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_ide_api/Cargo.toml
index 11c78ced8..d42a664b6 100644
--- a/crates/ra_analysis/Cargo.toml
+++ b/crates/ra_ide_api/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2edition = "2018" 2edition = "2018"
3name = "ra_analysis" 3name = "ra_ide_api"
4version = "0.1.0" 4version = "0.1.0"
5authors = ["Aleksey Kladov <[email protected]>"] 5authors = ["Aleksey Kladov <[email protected]>"]
6 6
@@ -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/call_info.rs b/crates/ra_ide_api/src/call_info.rs
index 27b760780..27b760780 100644
--- a/crates/ra_analysis/src/call_info.rs
+++ b/crates/ra_ide_api/src/call_info.rs
diff --git a/crates/ra_analysis/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index ce777a771..ce777a771 100644
--- a/crates/ra_analysis/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
diff --git a/crates/ra_analysis/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs
index 5d4e60dc5..5d4e60dc5 100644
--- a/crates/ra_analysis/src/completion/complete_dot.rs
+++ b/crates/ra_ide_api/src/completion/complete_dot.rs
diff --git a/crates/ra_analysis/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs
index c1739e47e..c1739e47e 100644
--- a/crates/ra_analysis/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs
diff --git a/crates/ra_analysis/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs
index d350f06ce..d350f06ce 100644
--- a/crates/ra_analysis/src/completion/complete_keyword.rs
+++ b/crates/ra_ide_api/src/completion/complete_keyword.rs
diff --git a/crates/ra_analysis/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs
index 4723a65a6..4723a65a6 100644
--- a/crates/ra_analysis/src/completion/complete_path.rs
+++ b/crates/ra_ide_api/src/completion/complete_path.rs
diff --git a/crates/ra_analysis/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index ee9052d3d..ee9052d3d 100644
--- a/crates/ra_analysis/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
diff --git a/crates/ra_analysis/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs
index a495751dd..a495751dd 100644
--- a/crates/ra_analysis/src/completion/complete_snippet.rs
+++ b/crates/ra_ide_api/src/completion/complete_snippet.rs
diff --git a/crates/ra_analysis/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index 01786bb69..01786bb69 100644
--- a/crates/ra_analysis/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
diff --git a/crates/ra_analysis/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs
index a25b87bee..a25b87bee 100644
--- a/crates/ra_analysis/src/completion/completion_item.rs
+++ b/crates/ra_ide_api/src/completion/completion_item.rs
diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_ide_api/src/db.rs
index 9d46609ec..9d46609ec 100644
--- a/crates/ra_analysis/src/db.rs
+++ b/crates/ra_ide_api/src/db.rs
diff --git a/crates/ra_analysis/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs
index 3b130f966..c3c809c9f 100644
--- a/crates/ra_analysis/src/extend_selection.rs
+++ b/crates/ra_ide_api/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/goto_defenition.rs b/crates/ra_ide_api/src/goto_defenition.rs
index fcd8d315e..fcd8d315e 100644
--- a/crates/ra_analysis/src/goto_defenition.rs
+++ b/crates/ra_ide_api/src/goto_defenition.rs
diff --git a/crates/ra_analysis/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index 475524ee1..475524ee1 100644
--- a/crates/ra_analysis/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index 2b9963b3c..7c60ab7d6 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_ide_api/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_ide_api/src/lib.rs
index 48df08416..7e9ca2034 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -1,8 +1,14 @@
1//! ra_analyzer crate provides "ide-centric" APIs for the rust-analyzer. What 1//! ra_ide_api crate provides "ide-centric" APIs for the rust-analyzer. That is,
2//! powers this API are the `RootDatabase` struct, which defines a `salsa` 2//! it generally operates with files and text ranges, and returns results as
3//! Strings, suitable for displaying to the human.
4//!
5//! What powers this API are the `RootDatabase` struct, which defines a `salsa`
3//! database, and the `ra_hir` crate, where majority of the analysis happens. 6//! database, and the `ra_hir` crate, where majority of the analysis happens.
4//! However, IDE specific bits of the analysis (most notably completion) happen 7//! However, IDE specific bits of the analysis (most notably completion) happen
5//! in this crate. 8//! in this crate.
9//!
10//! The sibling `ra_ide_api_light` handles thouse bits of IDE functionality
11//! which are restricted to a single file and need only syntax.
6macro_rules! ctry { 12macro_rules! ctry {
7 ($expr:expr) => { 13 ($expr:expr) => {
8 match $expr { 14 match $expr {
@@ -44,7 +50,7 @@ pub use crate::{
44 completion::{CompletionItem, CompletionItemKind, InsertText}, 50 completion::{CompletionItem, CompletionItemKind, InsertText},
45 runnables::{Runnable, RunnableKind}, 51 runnables::{Runnable, RunnableKind},
46}; 52};
47pub use ra_editor::{ 53pub use ra_ide_api_light::{
48 Fold, FoldKind, HighlightedRange, Severity, StructureNode, 54 Fold, FoldKind, HighlightedRange, Severity, StructureNode,
49 LineIndex, LineCol, translate_offset_with_edit, 55 LineIndex, LineCol, translate_offset_with_edit,
50}; 56};
@@ -336,25 +342,28 @@ impl Analysis {
336 /// Returns position of the mathcing brace (all types of braces are 342 /// Returns position of the mathcing brace (all types of braces are
337 /// supported). 343 /// supported).
338 pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> { 344 pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> {
339 ra_editor::matching_brace(file, offset) 345 ra_ide_api_light::matching_brace(file, offset)
340 } 346 }
341 /// Returns a syntax tree represented as `String`, for debug purposes. 347 /// Returns a syntax tree represented as `String`, for debug purposes.
342 // FIXME: use a better name here. 348 // FIXME: use a better name here.
343 pub fn syntax_tree(&self, file_id: FileId) -> String { 349 pub fn syntax_tree(&self, file_id: FileId) -> String {
344 let file = self.db.source_file(file_id); 350 let file = self.db.source_file(file_id);
345 ra_editor::syntax_tree(&file) 351 ra_ide_api_light::syntax_tree(&file)
346 } 352 }
347 /// Returns an edit to remove all newlines in the range, cleaning up minor 353 /// Returns an edit to remove all newlines in the range, cleaning up minor
348 /// stuff like trailing commas. 354 /// stuff like trailing commas.
349 pub fn join_lines(&self, frange: FileRange) -> SourceChange { 355 pub fn join_lines(&self, frange: FileRange) -> SourceChange {
350 let file = self.db.source_file(frange.file_id); 356 let file = self.db.source_file(frange.file_id);
351 SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range)) 357 SourceChange::from_local_edit(
358 frange.file_id,
359 ra_ide_api_light::join_lines(&file, frange.range),
360 )
352 } 361 }
353 /// Returns an edit which should be applied when opening a new line, fixing 362 /// Returns an edit which should be applied when opening a new line, fixing
354 /// up minor stuff like continuing the comment. 363 /// up minor stuff like continuing the comment.
355 pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> { 364 pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
356 let file = self.db.source_file(position.file_id); 365 let file = self.db.source_file(position.file_id);
357 let edit = ra_editor::on_enter(&file, position.offset)?; 366 let edit = ra_ide_api_light::on_enter(&file, position.offset)?;
358 Some(SourceChange::from_local_edit(position.file_id, edit)) 367 Some(SourceChange::from_local_edit(position.file_id, edit))
359 } 368 }
360 /// Returns an edit which should be applied after `=` was typed. Primarily, 369 /// Returns an edit which should be applied after `=` was typed. Primarily,
@@ -362,25 +371,25 @@ impl Analysis {
362 // FIXME: use a snippet completion instead of this hack here. 371 // FIXME: use a snippet completion instead of this hack here.
363 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { 372 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
364 let file = self.db.source_file(position.file_id); 373 let file = self.db.source_file(position.file_id);
365 let edit = ra_editor::on_eq_typed(&file, position.offset)?; 374 let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?;
366 Some(SourceChange::from_local_edit(position.file_id, edit)) 375 Some(SourceChange::from_local_edit(position.file_id, edit))
367 } 376 }
368 /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately. 377 /// 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> { 378 pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> {
370 let file = self.db.source_file(position.file_id); 379 let file = self.db.source_file(position.file_id);
371 let edit = ra_editor::on_dot_typed(&file, position.offset)?; 380 let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?;
372 Some(SourceChange::from_local_edit(position.file_id, edit)) 381 Some(SourceChange::from_local_edit(position.file_id, edit))
373 } 382 }
374 /// Returns a tree representation of symbols in the file. Useful to draw a 383 /// Returns a tree representation of symbols in the file. Useful to draw a
375 /// file outline. 384 /// file outline.
376 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 385 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
377 let file = self.db.source_file(file_id); 386 let file = self.db.source_file(file_id);
378 ra_editor::file_structure(&file) 387 ra_ide_api_light::file_structure(&file)
379 } 388 }
380 /// Returns the set of folding ranges. 389 /// Returns the set of folding ranges.
381 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> { 390 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
382 let file = self.db.source_file(file_id); 391 let file = self.db.source_file(file_id);
383 ra_editor::folding_ranges(&file) 392 ra_ide_api_light::folding_ranges(&file)
384 } 393 }
385 /// Fuzzy searches for a symbol. 394 /// Fuzzy searches for a symbol.
386 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> { 395 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> {
diff --git a/crates/ra_analysis/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs
index 846c76cfe..846c76cfe 100644
--- a/crates/ra_analysis/src/mock_analysis.rs
+++ b/crates/ra_ide_api/src/mock_analysis.rs
diff --git a/crates/ra_analysis/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs
index 98b1d2d55..98b1d2d55 100644
--- a/crates/ra_analysis/src/runnables.rs
+++ b/crates/ra_ide_api/src/runnables.rs
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 8dd15b40e..8dd15b40e 100644
--- a/crates/ra_analysis/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
diff --git a/crates/ra_analysis/src/syntax_highlighting.rs b/crates/ra_ide_api/src/syntax_highlighting.rs
index d2dc6cfbb..cb19e9515 100644
--- a/crates/ra_analysis/src/syntax_highlighting.rs
+++ b/crates/ra_ide_api/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_analysis/tests/test/main.rs b/crates/ra_ide_api/tests/test/main.rs
index 2c0735cb5..d1dc07e5b 100644
--- a/crates/ra_analysis/tests/test/main.rs
+++ b/crates/ra_ide_api/tests/test/main.rs
@@ -3,7 +3,7 @@ mod runnables;
3use ra_syntax::TextRange; 3use ra_syntax::TextRange;
4use test_utils::{assert_eq_dbg, assert_eq_text}; 4use test_utils::{assert_eq_dbg, assert_eq_text};
5 5
6use ra_analysis::{ 6use ra_ide_api::{
7 mock_analysis::{analysis_and_position, single_file, single_file_with_position, MockAnalysis}, 7 mock_analysis::{analysis_and_position, single_file, single_file_with_position, MockAnalysis},
8 AnalysisChange, CrateGraph, FileId, Query 8 AnalysisChange, CrateGraph, FileId, Query
9}; 9};
diff --git a/crates/ra_analysis/tests/test/runnables.rs b/crates/ra_ide_api/tests/test/runnables.rs
index e6e0afbc3..da8d5e0d5 100644
--- a/crates/ra_analysis/tests/test/runnables.rs
+++ b/crates/ra_ide_api/tests/test/runnables.rs
@@ -1,6 +1,6 @@
1use test_utils::assert_eq_dbg; 1use test_utils::assert_eq_dbg;
2 2
3use ra_analysis::mock_analysis::analysis_and_position; 3use ra_ide_api::mock_analysis::analysis_and_position;
4 4
5#[test] 5#[test]
6fn test_runnables() { 6fn test_runnables() {
diff --git a/crates/ra_editor/Cargo.toml b/crates/ra_ide_api_light/Cargo.toml
index a97d2308f..8c192fca6 100644
--- a/crates/ra_editor/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_editor/src/assists.rs b/crates/ra_ide_api_light/src/assists.rs
index 83eabfc85..83eabfc85 100644
--- a/crates/ra_editor/src/assists.rs
+++ b/crates/ra_ide_api_light/src/assists.rs
diff --git a/crates/ra_editor/src/assists/add_derive.rs b/crates/ra_ide_api_light/src/assists/add_derive.rs
index 6e964d011..6e964d011 100644
--- a/crates/ra_editor/src/assists/add_derive.rs
+++ b/crates/ra_ide_api_light/src/assists/add_derive.rs
diff --git a/crates/ra_editor/src/assists/add_impl.rs b/crates/ra_ide_api_light/src/assists/add_impl.rs
index 2eda7cae2..2eda7cae2 100644
--- a/crates/ra_editor/src/assists/add_impl.rs
+++ b/crates/ra_ide_api_light/src/assists/add_impl.rs
diff --git a/crates/ra_editor/src/assists/change_visibility.rs b/crates/ra_ide_api_light/src/assists/change_visibility.rs
index 89729e2c2..89729e2c2 100644
--- a/crates/ra_editor/src/assists/change_visibility.rs
+++ b/crates/ra_ide_api_light/src/assists/change_visibility.rs
diff --git a/crates/ra_editor/src/assists/flip_comma.rs b/crates/ra_ide_api_light/src/assists/flip_comma.rs
index a343413cc..a343413cc 100644
--- a/crates/ra_editor/src/assists/flip_comma.rs
+++ b/crates/ra_ide_api_light/src/assists/flip_comma.rs
diff --git a/crates/ra_editor/src/assists/introduce_variable.rs b/crates/ra_ide_api_light/src/assists/introduce_variable.rs
index 523ec7034..523ec7034 100644
--- a/crates/ra_editor/src/assists/introduce_variable.rs
+++ b/crates/ra_ide_api_light/src/assists/introduce_variable.rs
diff --git a/crates/ra_editor/src/assists/replace_if_let_with_match.rs b/crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs
index 30c371480..30c371480 100644
--- a/crates/ra_editor/src/assists/replace_if_let_with_match.rs
+++ b/crates/ra_ide_api_light/src/assists/replace_if_let_with_match.rs
diff --git a/crates/ra_editor/src/assists/split_import.rs b/crates/ra_ide_api_light/src/assists/split_import.rs
index e4015f07d..e4015f07d 100644
--- a/crates/ra_editor/src/assists/split_import.rs
+++ b/crates/ra_ide_api_light/src/assists/split_import.rs
diff --git a/crates/ra_editor/src/diagnostics.rs b/crates/ra_ide_api_light/src/diagnostics.rs
index 2b695dfdf..2b695dfdf 100644
--- a/crates/ra_editor/src/diagnostics.rs
+++ b/crates/ra_ide_api_light/src/diagnostics.rs
diff --git a/crates/ra_editor/src/extend_selection.rs b/crates/ra_ide_api_light/src/extend_selection.rs
index 08cae5a51..08cae5a51 100644
--- a/crates/ra_editor/src/extend_selection.rs
+++ b/crates/ra_ide_api_light/src/extend_selection.rs
diff --git a/crates/ra_editor/src/folding_ranges.rs b/crates/ra_ide_api_light/src/folding_ranges.rs
index 6f3106889..6f3106889 100644
--- a/crates/ra_editor/src/folding_ranges.rs
+++ b/crates/ra_ide_api_light/src/folding_ranges.rs
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs
index 5a6af19b7..40638eda8 100644
--- a/crates/ra_editor/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;
diff --git a/crates/ra_editor/src/line_index.rs b/crates/ra_ide_api_light/src/line_index.rs
index 898fee7e0..898fee7e0 100644
--- a/crates/ra_editor/src/line_index.rs
+++ b/crates/ra_ide_api_light/src/line_index.rs
diff --git a/crates/ra_editor/src/line_index_utils.rs b/crates/ra_ide_api_light/src/line_index_utils.rs
index ec3269bbb..ec3269bbb 100644
--- a/crates/ra_editor/src/line_index_utils.rs
+++ b/crates/ra_ide_api_light/src/line_index_utils.rs
diff --git a/crates/ra_editor/src/structure.rs b/crates/ra_ide_api_light/src/structure.rs
index 8bd57555f..8bd57555f 100644
--- a/crates/ra_editor/src/structure.rs
+++ b/crates/ra_ide_api_light/src/structure.rs
diff --git a/crates/ra_editor/src/test_utils.rs b/crates/ra_ide_api_light/src/test_utils.rs
index dc2470aa3..dc2470aa3 100644
--- a/crates/ra_editor/src/test_utils.rs
+++ b/crates/ra_ide_api_light/src/test_utils.rs
diff --git a/crates/ra_editor/src/typing.rs b/crates/ra_ide_api_light/src/typing.rs
index d8177f245..d8177f245 100644
--- a/crates/ra_editor/src/typing.rs
+++ b/crates/ra_ide_api_light/src/typing.rs
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml
index b9fd61105..296fae34f 100644
--- a/crates/ra_lsp_server/Cargo.toml
+++ b/crates/ra_lsp_server/Cargo.toml
@@ -29,7 +29,7 @@ parking_lot = "0.7.0"
29thread_worker = { path = "../thread_worker" } 29thread_worker = { path = "../thread_worker" }
30ra_syntax = { path = "../ra_syntax" } 30ra_syntax = { path = "../ra_syntax" }
31ra_text_edit = { path = "../ra_text_edit" } 31ra_text_edit = { path = "../ra_text_edit" }
32ra_analysis = { path = "../ra_analysis" } 32ra_ide_api = { path = "../ra_ide_api" }
33gen_lsp_server = { path = "../gen_lsp_server" } 33gen_lsp_server = { path = "../gen_lsp_server" }
34ra_vfs = { path = "../ra_vfs" } 34ra_vfs = { path = "../ra_vfs" }
35 35
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index b3f8c83cc..5c8b3c194 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -4,7 +4,7 @@ use languageserver_types::{
4 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, 4 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier,
5 WorkspaceEdit, 5 WorkspaceEdit,
6}; 6};
7use ra_analysis::{ 7use ra_ide_api::{
8 CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit, 8 CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit,
9 InsertText, NavigationTarget, SourceChange, SourceFileEdit, 9 InsertText, NavigationTarget, SourceChange, SourceFileEdit,
10 LineCol, LineIndex, translate_offset_with_edit 10 LineCol, LineIndex, translate_offset_with_edit
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index 2dc1be26a..96923fac7 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -10,7 +10,7 @@ use gen_lsp_server::{
10 handle_shutdown, ErrorCode, RawMessage, RawNotification, RawRequest, RawResponse, 10 handle_shutdown, ErrorCode, RawMessage, RawNotification, RawRequest, RawResponse,
11}; 11};
12use languageserver_types::NumberOrString; 12use languageserver_types::NumberOrString;
13use ra_analysis::{Canceled, FileId, LibraryData}; 13use ra_ide_api::{Canceled, FileId, LibraryData};
14use ra_vfs::VfsTask; 14use ra_vfs::VfsTask;
15use rayon; 15use rayon;
16use rustc_hash::FxHashSet; 16use rustc_hash::FxHashSet;
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index b7777bfc3..a653c5ada 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -8,7 +8,7 @@ use languageserver_types::{
8 ParameterInformation, ParameterLabel, Position, PrepareRenameResponse, Range, RenameParams, 8 ParameterInformation, ParameterLabel, Position, PrepareRenameResponse, Range, RenameParams,
9 SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit, 9 SignatureInformation, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit,
10}; 10};
11use ra_analysis::{ 11use ra_ide_api::{
12 FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange, 12 FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, SourceChange,
13}; 13};
14use ra_syntax::{TextUnit, AstNode}; 14use ra_syntax::{TextUnit, AstNode};
@@ -736,7 +736,7 @@ fn highlight(world: &ServerWorld, file_id: FileId) -> Result<Vec<Decoration>> {
736} 736}
737 737
738fn to_diagnostic_severity(severity: Severity) -> DiagnosticSeverity { 738fn to_diagnostic_severity(severity: Severity) -> DiagnosticSeverity {
739 use ra_analysis::Severity::*; 739 use ra_ide_api::Severity::*;
740 740
741 match severity { 741 match severity {
742 Error => DiagnosticSeverity::Error, 742 Error => DiagnosticSeverity::Error,
diff --git a/crates/ra_lsp_server/src/main_loop/subscriptions.rs b/crates/ra_lsp_server/src/main_loop/subscriptions.rs
index 03f41e870..a83e01557 100644
--- a/crates/ra_lsp_server/src/main_loop/subscriptions.rs
+++ b/crates/ra_lsp_server/src/main_loop/subscriptions.rs
@@ -1,4 +1,4 @@
1use ra_analysis::FileId; 1use ra_ide_api::FileId;
2use rustc_hash::FxHashSet; 2use rustc_hash::FxHashSet;
3 3
4pub struct Subscriptions { 4pub struct Subscriptions {
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs
index ebf2b15cc..76c76766d 100644
--- a/crates/ra_lsp_server/src/server_world.rs
+++ b/crates/ra_lsp_server/src/server_world.rs
@@ -1,10 +1,10 @@
1use std::{ 1use std::{
2 path::{PathBuf}, 2 path::PathBuf,
3 sync::Arc, 3 sync::Arc,
4}; 4};
5 5
6use languageserver_types::Url; 6use languageserver_types::Url;
7use ra_analysis::{ 7use ra_ide_api::{
8 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, 8 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData,
9 SourceRootId 9 SourceRootId
10}; 10};
@@ -12,7 +12,7 @@ use ra_vfs::{Vfs, VfsChange, VfsFile, VfsRoot};
12use rustc_hash::FxHashMap; 12use rustc_hash::FxHashMap;
13use relative_path::RelativePathBuf; 13use relative_path::RelativePathBuf;
14use parking_lot::RwLock; 14use parking_lot::RwLock;
15use failure::{format_err}; 15use failure::format_err;
16 16
17use crate::{ 17use crate::{
18 project_model::{CargoWorkspace, TargetKind}, 18 project_model::{CargoWorkspace, TargetKind},