diff options
author | Sergey Parilin <[email protected]> | 2019-03-22 12:54:26 +0000 |
---|---|---|
committer | Sergey Parilin <[email protected]> | 2019-03-25 08:41:21 +0000 |
commit | 36cb58f76d702d87f445ee7eefe26a0bc1ee3811 (patch) | |
tree | a13de9e2de33ec86524d360acaa0793540363c2f | |
parent | afe96b75eae99fe2dcd7fb7c99e15507290b3d5f (diff) |
structure moved to ra_ide_api
ra_ide_api_light removed completely
-rw-r--r-- | Cargo.lock | 18 | ||||
-rw-r--r-- | crates/ra_cli/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_cli/src/main.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 11 | ||||
-rw-r--r-- | crates/ra_ide_api/src/snapshots/tests__file_structure.snap (renamed from crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap) | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/structure.rs (renamed from crates/ra_ide_api_light/src/structure.rs) | 0 | ||||
-rw-r--r-- | crates/ra_ide_api_light/Cargo.toml | 26 | ||||
-rw-r--r-- | crates/ra_ide_api_light/src/lib.rs | 12 | ||||
-rw-r--r-- | docs/dev/architecture.md | 13 |
10 files changed, 7 insertions, 79 deletions
diff --git a/Cargo.lock b/Cargo.lock index 1b5de271e..653eaa6c2 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -929,7 +929,6 @@ dependencies = [ | |||
929 | "ra_db 0.1.0", | 929 | "ra_db 0.1.0", |
930 | "ra_hir 0.1.0", | 930 | "ra_hir 0.1.0", |
931 | "ra_ide_api 0.1.0", | 931 | "ra_ide_api 0.1.0", |
932 | "ra_ide_api_light 0.1.0", | ||
933 | "ra_syntax 0.1.0", | 932 | "ra_syntax 0.1.0", |
934 | "tools 0.1.0", | 933 | "tools 0.1.0", |
935 | ] | 934 | ] |
@@ -993,7 +992,6 @@ dependencies = [ | |||
993 | "ra_db 0.1.0", | 992 | "ra_db 0.1.0", |
994 | "ra_fmt 0.1.0", | 993 | "ra_fmt 0.1.0", |
995 | "ra_hir 0.1.0", | 994 | "ra_hir 0.1.0", |
996 | "ra_ide_api_light 0.1.0", | ||
997 | "ra_syntax 0.1.0", | 995 | "ra_syntax 0.1.0", |
998 | "ra_text_edit 0.1.0", | 996 | "ra_text_edit 0.1.0", |
999 | "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | 997 | "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", |
@@ -1005,22 +1003,6 @@ dependencies = [ | |||
1005 | ] | 1003 | ] |
1006 | 1004 | ||
1007 | [[package]] | 1005 | [[package]] |
1008 | name = "ra_ide_api_light" | ||
1009 | version = "0.1.0" | ||
1010 | dependencies = [ | ||
1011 | "insta 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1012 | "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1013 | "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1014 | "proptest 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1015 | "ra_fmt 0.1.0", | ||
1016 | "ra_syntax 0.1.0", | ||
1017 | "ra_text_edit 0.1.0", | ||
1018 | "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1019 | "superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
1020 | "test_utils 0.1.0", | ||
1021 | ] | ||
1022 | |||
1023 | [[package]] | ||
1024 | name = "ra_lsp_server" | 1006 | name = "ra_lsp_server" |
1025 | version = "0.1.0" | 1007 | version = "0.1.0" |
1026 | dependencies = [ | 1008 | dependencies = [ |
diff --git a/crates/ra_cli/Cargo.toml b/crates/ra_cli/Cargo.toml index 4c666f556..467628236 100644 --- a/crates/ra_cli/Cargo.toml +++ b/crates/ra_cli/Cargo.toml | |||
@@ -14,7 +14,6 @@ indicatif = "0.11.0" | |||
14 | 14 | ||
15 | ra_syntax = { path = "../ra_syntax" } | 15 | ra_syntax = { path = "../ra_syntax" } |
16 | ra_ide_api = { path = "../ra_ide_api" } | 16 | ra_ide_api = { path = "../ra_ide_api" } |
17 | ra_ide_api_light = { path = "../ra_ide_api_light" } | ||
18 | tools = { path = "../tools" } | 17 | tools = { path = "../tools" } |
19 | ra_batch = { path = "../ra_batch" } | 18 | ra_batch = { path = "../ra_batch" } |
20 | ra_hir = { path = "../ra_hir" } | 19 | ra_hir = { path = "../ra_hir" } |
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index 5285f1f28..11f5541eb 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs | |||
@@ -5,7 +5,7 @@ use std::{fs, io::Read, path::Path, time::Instant}; | |||
5 | use clap::{App, Arg, SubCommand}; | 5 | use clap::{App, Arg, SubCommand}; |
6 | use join_to_string::join; | 6 | use join_to_string::join; |
7 | use ra_ide_api::{Analysis, FileRange}; | 7 | use ra_ide_api::{Analysis, FileRange}; |
8 | use ra_ide_api_light::file_structure; | 8 | use ra_ide_api::file_structure; |
9 | use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode}; | 9 | use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode}; |
10 | use tools::collect_tests; | 10 | use tools::collect_tests; |
11 | use flexi_logger::Logger; | 11 | use flexi_logger::Logger; |
diff --git a/crates/ra_ide_api/Cargo.toml b/crates/ra_ide_api/Cargo.toml index c64226801..45bab4e28 100644 --- a/crates/ra_ide_api/Cargo.toml +++ b/crates/ra_ide_api/Cargo.toml | |||
@@ -20,7 +20,6 @@ jemallocator = { version = "0.1.9", optional = true } | |||
20 | jemalloc-ctl = { version = "0.2.0", optional = true } | 20 | jemalloc-ctl = { version = "0.2.0", optional = true } |
21 | 21 | ||
22 | ra_syntax = { path = "../ra_syntax" } | 22 | ra_syntax = { path = "../ra_syntax" } |
23 | ra_ide_api_light = { path = "../ra_ide_api_light" } | ||
24 | ra_text_edit = { path = "../ra_text_edit" } | 23 | ra_text_edit = { path = "../ra_text_edit" } |
25 | ra_db = { path = "../ra_db" } | 24 | ra_db = { path = "../ra_db" } |
26 | ra_fmt = { path = "../ra_fmt" } | 25 | ra_fmt = { path = "../ra_fmt" } |
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index 8aa3eb088..9063f78a9 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -6,9 +6,6 @@ | |||
6 | //! 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. |
7 | //! However, IDE specific bits of the analysis (most notably completion) happen | 7 | //! However, IDE specific bits of the analysis (most notably completion) happen |
8 | //! in this crate. | 8 | //! in this crate. |
9 | //! | ||
10 | //! The sibling `ra_ide_api_light` handles those bits of IDE functionality | ||
11 | //! which are restricted to a single file and need only syntax. | ||
12 | 9 | ||
13 | // For proving that RootDatabase is RefUnwindSafe. | 10 | // For proving that RootDatabase is RefUnwindSafe. |
14 | #![recursion_limit = "128"] | 11 | #![recursion_limit = "128"] |
@@ -33,10 +30,11 @@ mod impls; | |||
33 | mod assists; | 30 | mod assists; |
34 | mod diagnostics; | 31 | mod diagnostics; |
35 | mod syntax_tree; | 32 | mod syntax_tree; |
36 | mod line_index; | ||
37 | mod folding_ranges; | 33 | mod folding_ranges; |
34 | mod line_index; | ||
38 | mod line_index_utils; | 35 | mod line_index_utils; |
39 | mod join_lines; | 36 | mod join_lines; |
37 | mod structure; | ||
40 | mod typing; | 38 | mod typing; |
41 | mod matching_brace; | 39 | mod matching_brace; |
42 | 40 | ||
@@ -72,9 +70,10 @@ pub use crate::{ | |||
72 | line_index_utils::translate_offset_with_edit, | 70 | line_index_utils::translate_offset_with_edit, |
73 | folding_ranges::{Fold, FoldKind}, | 71 | folding_ranges::{Fold, FoldKind}, |
74 | syntax_highlighting::HighlightedRange, | 72 | syntax_highlighting::HighlightedRange, |
73 | structure::{StructureNode, file_structure}, | ||
75 | diagnostics::Severity, | 74 | diagnostics::Severity, |
76 | }; | 75 | }; |
77 | pub use ra_ide_api_light::StructureNode; | 76 | |
78 | pub use ra_db::{ | 77 | pub use ra_db::{ |
79 | Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId, | 78 | Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId, |
80 | Edition | 79 | Edition |
@@ -388,7 +387,7 @@ impl Analysis { | |||
388 | /// file outline. | 387 | /// file outline. |
389 | pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { | 388 | pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { |
390 | let file = self.db.parse(file_id); | 389 | let file = self.db.parse(file_id); |
391 | ra_ide_api_light::file_structure(&file) | 390 | structure::file_structure(&file) |
392 | } | 391 | } |
393 | 392 | ||
394 | /// Returns the set of folding ranges. | 393 | /// Returns the set of folding ranges. |
diff --git a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap b/crates/ra_ide_api/src/snapshots/tests__file_structure.snap index 8e4184b31..2efa8e22c 100644 --- a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap +++ b/crates/ra_ide_api/src/snapshots/tests__file_structure.snap | |||
@@ -1,7 +1,7 @@ | |||
1 | --- | 1 | --- |
2 | created: "2019-02-05T22:03:50.763530100Z" | 2 | created: "2019-02-05T22:03:50.763530100Z" |
3 | creator: [email protected] | 3 | creator: [email protected] |
4 | source: crates/ra_ide_api_light/src/structure.rs | 4 | source: crates/ra_ide_api/src/structure.rs |
5 | expression: structure | 5 | expression: structure |
6 | --- | 6 | --- |
7 | [ | 7 | [ |
diff --git a/crates/ra_ide_api_light/src/structure.rs b/crates/ra_ide_api/src/structure.rs index ec2c9bbc6..ec2c9bbc6 100644 --- a/crates/ra_ide_api_light/src/structure.rs +++ b/crates/ra_ide_api/src/structure.rs | |||
diff --git a/crates/ra_ide_api_light/Cargo.toml b/crates/ra_ide_api_light/Cargo.toml deleted file mode 100644 index 4e69f5325..000000000 --- a/crates/ra_ide_api_light/Cargo.toml +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | [package] | ||
2 | edition = "2018" | ||
3 | name = "ra_ide_api_light" | ||
4 | version = "0.1.0" | ||
5 | authors = ["rust-analyzer developers"] | ||
6 | publish = false | ||
7 | |||
8 | [dependencies] | ||
9 | itertools = "0.8.0" | ||
10 | superslice = "1.0.0" | ||
11 | join_to_string = "0.1.1" | ||
12 | rustc-hash = "1.0" | ||
13 | |||
14 | ra_syntax = { path = "../ra_syntax" } | ||
15 | ra_text_edit = { path = "../ra_text_edit" } | ||
16 | ra_fmt = { path = "../ra_fmt" } | ||
17 | |||
18 | [dev-dependencies] | ||
19 | test_utils = { path = "../test_utils" } | ||
20 | insta = "0.7.0" | ||
21 | |||
22 | [dev-dependencies.proptest] | ||
23 | version = "0.9.0" | ||
24 | # Disable `fork` feature to allow compiling on webassembly | ||
25 | default-features = false | ||
26 | features = ["std", "bit-set", "break-dead-code"] | ||
diff --git a/crates/ra_ide_api_light/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs deleted file mode 100644 index df7f144b6..000000000 --- a/crates/ra_ide_api_light/src/lib.rs +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | //! This crate provides those IDE features which use only a single file. | ||
2 | //! | ||
3 | //! This usually means functions which take syntax tree as an input and produce | ||
4 | //! an edit or some auxiliary info. | ||
5 | |||
6 | mod structure; | ||
7 | |||
8 | use ra_syntax::TextRange; | ||
9 | |||
10 | pub use crate::{ | ||
11 | structure::{file_structure, StructureNode}, | ||
12 | }; | ||
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index f990d5bf0..890b18fcd 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md | |||
@@ -130,19 +130,6 @@ APIs in this crate are IDE centric: they take text offsets as input and produce | |||
130 | offsets and strings as output. This works on top of rich code model powered by | 130 | offsets and strings as output. This works on top of rich code model powered by |
131 | `hir`. | 131 | `hir`. |
132 | 132 | ||
133 | ### `crates/ra_ide_api_light` | ||
134 | |||
135 | All IDE features which can be implemented if you only have access to a single | ||
136 | file. `ra_ide_api_light` could be used to enhance editing of Rust code without | ||
137 | the need to fiddle with build-systems, file synchronization and such. | ||
138 | |||
139 | In a sense, `ra_ide_api_light` is just a bunch of pure functions which take a | ||
140 | syntax tree as input. | ||
141 | |||
142 | The tests for `ra_ide_api_light` are `#[cfg(test)] mod tests` unit-tests spread | ||
143 | throughout its modules. | ||
144 | |||
145 | |||
146 | ### `crates/ra_lsp_server` | 133 | ### `crates/ra_lsp_server` |
147 | 134 | ||
148 | An LSP implementation which wraps `ra_ide_api` into a langauge server protocol. | 135 | An LSP implementation which wraps `ra_ide_api` into a langauge server protocol. |