aboutsummaryrefslogtreecommitdiff
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
parent4f4f7933b1b7ff34f8633b1686b18b2d1b994c47 (diff)
parent0c62b1bb7a49bf527780ce1f8cade5eb4fbfdb2d (diff)
Merge #471
471: rename crates to match reality r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--ARCHITECTURE.md57
-rw-r--r--Cargo.lock94
-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
52 files changed, 132 insertions, 104 deletions
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 277b29c12..9c404f4c3 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -15,7 +15,7 @@ More specifically, input data consists of a set of test files (`(PathBuf,
15String)` pairs) and an information about project structure, the so called 15String)` pairs) and an information about project structure, the so called
16`CrateGraph`. Crate graph specifies which files are crate roots, which cfg flags 16`CrateGraph`. Crate graph specifies which files are crate roots, which cfg flags
17are specified for each crate (TODO: actually implement this) and what are 17are specified for each crate (TODO: actually implement this) and what are
18dependencies between the crate. The analyzer keeps all these input data in 18dependencies between the crates. The analyzer keeps all these input data in
19memory and never does any IO. Because the input data is source code, which 19memory and never does any IO. Because the input data is source code, which
20typically measures in tens of megabytes at most, keeping all input data in 20typically measures in tens of megabytes at most, keeping all input data in
21memory is OK. 21memory is OK.
@@ -74,9 +74,9 @@ notes.
74- `algo`: generic tree algorithms, including `walk` for O(1) stack 74- `algo`: generic tree algorithms, including `walk` for O(1) stack
75 space tree traversal (this is cool) and `visit` for type-driven 75 space tree traversal (this is cool) and `visit` for type-driven
76 visiting the nodes (this is double plus cool, if you understand how 76 visiting the nodes (this is double plus cool, if you understand how
77 `Visitor` works, you understand rust-analyzer). 77 `Visitor` works, you understand the design of syntax trees).
78 78
79Test for ra_syntax are mostly data-driven: `tests/data/parser` contains a bunch of `.rs` 79Tests for ra_syntax are mostly data-driven: `tests/data/parser` contains a bunch of `.rs`
80(test vectors) and `.txt` files with corresponding syntax trees. During testing, we check 80(test vectors) and `.txt` files with corresponding syntax trees. During testing, we check
81`.rs` against `.txt`. If the `.txt` file is missing, it is created (this is how you update 81`.rs` against `.txt`. If the `.txt` file is missing, it is created (this is how you update
82tests). Additionally, running `cargo gen-tests` will walk the grammar module and collect 82tests). Additionally, running `cargo gen-tests` will walk the grammar module and collect
@@ -107,41 +107,46 @@ guessing a HIR for a particular source position.
107 107
108Underneath, HIR works on top of salsa, using a `HirDatabase` trait. 108Underneath, HIR works on top of salsa, using a `HirDatabase` trait.
109 109
110### `crates/ra_analysis` 110### `crates/ra_ide_api`
111 111
112A stateful library for analyzing many Rust files as they change. 112A stateful library for analyzing many Rust files as they change. `AnalysisHost`
113`AnalysisHost` is a mutable entity (clojure's atom) which holds the 113is a mutable entity (clojure's atom) which holds the current state, incorporates
114current state, incorporates changes and handles out `Analysis` --- an 114changes and handles out `Analysis` --- an immutable and consistent snapshot of
115immutable and consistent snapshot of world state at a point in time, which 115world state at a point in time, which actually powers analysis.
116actually powers analysis.
117 116
118One interesting aspect of analysis is its support for cancellation. When a change 117One interesting aspect of analysis is its support for cancellation. When a
119is applied to `AnalysisHost`, first all currently active snapshots are 118change is applied to `AnalysisHost`, first all currently active snapshots are
120cancelled. Only after all snapshots are dropped the change actually affects the 119cancelled. Only after all snapshots are dropped the change actually affects the
121database. 120database.
122 121
123### `crates/ra_lsp_server` 122APIs in this crate are IDE centric: they take text offsets as input and produce
124 123offsets and strings as output. This works on top of rich code model powered by
125An LSP implementation which uses `ra_analysis` for managing state and 124`hir`.
126`ra_editor` for actually doing useful stuff.
127
128See [#79](https://github.com/rust-analyzer/rust-analyzer/pull/79/) as an
129example of PR which adds a new feature to `ra_editor` and exposes it
130to `ra_lsp_server`.
131 125
132### `crates/ra_editor` 126### `crates/ra_ide_api_light`
133 127
134All IDE features which can be implemented if you only have access to a 128All IDE features which can be implemented if you only have access to a single
135single file. `ra_editor` could be used to enhance editing of Rust code 129file. `ra_ide_api_light` could be used to enhance editing of Rust code without
136without the need to fiddle with build-systems, file 130the need to fiddle with build-systems, file synchronization and such.
137synchronization and such.
138 131
139In a sense, `ra_editor` is just a bunch of pure functions which take a 132In a sense, `ra_ide_api_light` is just a bunch of pure functions which take a
140syntax tree as input. 133syntax tree as input.
141 134
142The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread 135The tests for `ra_ide_api_light` are `#[cfg(test)] mod tests` unit-tests spread
143throughout its modules. 136throughout its modules.
144 137
138
139### `crates/ra_lsp_server`
140
141An LSP implementation which wraps `ra_ide_api` into a langauge server protocol.
142
143### `crates/ra_vfs`
144
145Although `hir` and `ra_ide_api` don't do any io, we need to be able to read
146files from disk at the end of the day. This is what `ra_vfs` does. It also
147manages overlays: "dirty" files in the editor, whose "true" contents is
148different from data on disk.
149
145### `crates/gen_lsp_server` 150### `crates/gen_lsp_server`
146 151
147A language server scaffold, exposing a synchronous crossbeam-channel based API. 152A language server scaffold, exposing a synchronous crossbeam-channel based API.
diff --git a/Cargo.lock b/Cargo.lock
index f1d8e5462..354cc138b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -171,7 +171,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
171dependencies = [ 171dependencies = [
172 "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 172 "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
173 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 173 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
174 "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 174 "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
175 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 175 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
176] 176]
177 177
@@ -548,7 +548,7 @@ version = "0.4.0"
548source = "registry+https://github.com/rust-lang/crates.io-index" 548source = "registry+https://github.com/rust-lang/crates.io-index"
549dependencies = [ 549dependencies = [
550 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", 550 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
551 "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 551 "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
552 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 552 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
553 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 553 "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
554 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 554 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -637,27 +637,6 @@ dependencies = [
637] 637]
638 638
639[[package]] 639[[package]]
640name = "ra_analysis"
641version = "0.1.0"
642dependencies = [
643 "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
644 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
645 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
646 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
647 "ra_db 0.1.0",
648 "ra_editor 0.1.0",
649 "ra_hir 0.1.0",
650 "ra_syntax 0.1.0",
651 "ra_text_edit 0.1.0",
652 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
653 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
654 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
655 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
656 "test_utils 0.1.0",
657 "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
658]
659
660[[package]]
661name = "ra_arena" 640name = "ra_arena"
662version = "0.1.0" 641version = "0.1.0"
663 642
@@ -668,7 +647,7 @@ dependencies = [
668 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 647 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
669 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 648 "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
670 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 649 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
671 "ra_editor 0.1.0", 650 "ra_ide_api_light 0.1.0",
672 "ra_syntax 0.1.0", 651 "ra_syntax 0.1.0",
673 "tools 0.1.0", 652 "tools 0.1.0",
674] 653]
@@ -687,35 +666,56 @@ dependencies = [
687] 666]
688 667
689[[package]] 668[[package]]
690name = "ra_editor" 669name = "ra_hir"
691version = "0.1.0" 670version = "0.1.0"
692dependencies = [ 671dependencies = [
693 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 672 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
694 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 673 "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
695 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", 674 "flexi_logger 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
675 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
676 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
677 "ra_arena 0.1.0",
678 "ra_db 0.1.0",
696 "ra_syntax 0.1.0", 679 "ra_syntax 0.1.0",
697 "ra_text_edit 0.1.0", 680 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
698 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 681 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
699 "superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 682 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
700 "test_utils 0.1.0", 683 "test_utils 0.1.0",
701] 684]
702 685
703[[package]] 686[[package]]
704name = "ra_hir" 687name = "ra_ide_api"
705version = "0.1.0" 688version = "0.1.0"
706dependencies = [ 689dependencies = [
707 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 690 "fst 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
708 "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 691 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
709 "flexi_logger 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
710 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 692 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
711 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 693 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
712 "ra_arena 0.1.0",
713 "ra_db 0.1.0", 694 "ra_db 0.1.0",
695 "ra_hir 0.1.0",
696 "ra_ide_api_light 0.1.0",
714 "ra_syntax 0.1.0", 697 "ra_syntax 0.1.0",
698 "ra_text_edit 0.1.0",
699 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
715 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 700 "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
716 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 701 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
717 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", 702 "salsa 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
718 "test_utils 0.1.0", 703 "test_utils 0.1.0",
704 "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
705]
706
707[[package]]
708name = "ra_ide_api_light"
709version = "0.1.0"
710dependencies = [
711 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
712 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
713 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
714 "ra_syntax 0.1.0",
715 "ra_text_edit 0.1.0",
716 "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
717 "superslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
718 "test_utils 0.1.0",
719] 719]
720 720
721[[package]] 721[[package]]
@@ -733,7 +733,7 @@ dependencies = [
733 "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)", 733 "languageserver-types 0.53.1 (registry+https://github.com/rust-lang/crates.io-index)",
734 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 734 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
735 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 735 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
736 "ra_analysis 0.1.0", 736 "ra_ide_api 0.1.0",
737 "ra_syntax 0.1.0", 737 "ra_syntax 0.1.0",
738 "ra_text_edit 0.1.0", 738 "ra_text_edit 0.1.0",
739 "ra_vfs 0.1.0", 739 "ra_vfs 0.1.0",
@@ -806,7 +806,7 @@ dependencies = [
806 806
807[[package]] 807[[package]]
808name = "rand" 808name = "rand"
809version = "0.6.3" 809version = "0.6.4"
810source = "registry+https://github.com/rust-lang/crates.io-index" 810source = "registry+https://github.com/rust-lang/crates.io-index"
811dependencies = [ 811dependencies = [
812 "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 812 "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -815,7 +815,7 @@ dependencies = [
815 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 815 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
816 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 816 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
817 "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 817 "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
818 "rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 818 "rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
819 "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 819 "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
820 "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 820 "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
821 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 821 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -861,13 +861,14 @@ dependencies = [
861 861
862[[package]] 862[[package]]
863name = "rand_os" 863name = "rand_os"
864version = "0.1.0" 864version = "0.1.1"
865source = "registry+https://github.com/rust-lang/crates.io-index" 865source = "registry+https://github.com/rust-lang/crates.io-index"
866dependencies = [ 866dependencies = [
867 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 867 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
868 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 868 "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
869 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", 869 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
870 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 870 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
871 "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
871 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 872 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
872] 873]
873 874
@@ -910,6 +911,14 @@ dependencies = [
910] 911]
911 912
912[[package]] 913[[package]]
914name = "rdrand"
915version = "0.4.0"
916source = "registry+https://github.com/rust-lang/crates.io-index"
917dependencies = [
918 "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
919]
920
921[[package]]
913name = "redox_syscall" 922name = "redox_syscall"
914version = "0.1.50" 923version = "0.1.50"
915source = "registry+https://github.com/rust-lang/crates.io-index" 924source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1164,7 +1173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1164dependencies = [ 1173dependencies = [
1165 "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 1174 "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
1166 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", 1175 "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
1167 "rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 1176 "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
1168 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", 1177 "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
1169 "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 1178 "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1170 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 1179 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1551,17 +1560,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1551"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" 1560"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
1552"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" 1561"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
1553"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" 1562"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
1554"checksum rand 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b65e163105a6284f841bd23100a015895f54340e88a5ffc9ca7b8b33827cfce0" 1563"checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5"
1555"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" 1564"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
1556"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" 1565"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
1557"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" 1566"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
1558"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" 1567"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
1559"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" 1568"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
1560"checksum rand_os 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de5ac4de1c2973e1391dc305cb0fbf8788cb58068e98255439b7485a77022273" 1569"checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca"
1561"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" 1570"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05"
1562"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" 1571"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
1563"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" 1572"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473"
1564"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" 1573"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356"
1574"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
1565"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" 1575"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2"
1566"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 1576"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
1567"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" 1577"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
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},