aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock58
-rw-r--r--crates/ra_analysis/Cargo.toml2
-rw-r--r--crates/ra_analysis/src/extend_selection.rs4
-rw-r--r--crates/ra_analysis/src/imp.rs4
-rw-r--r--crates/ra_analysis/src/lib.rs21
-rw-r--r--crates/ra_analysis/src/syntax_highlighting.rs7
-rw-r--r--crates/ra_cli/Cargo.toml2
-rw-r--r--crates/ra_cli/src/main.rs2
-rw-r--r--crates/ra_ide_api_light/Cargo.toml2
-rw-r--r--crates/ra_ide_api_light/src/lib.rs5
10 files changed, 62 insertions, 45 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f1d8e5462..f99a03424 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)",
@@ -645,8 +645,8 @@ dependencies = [
645 "log 0.4.6 (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)", 646 "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
647 "ra_db 0.1.0", 647 "ra_db 0.1.0",
648 "ra_editor 0.1.0",
649 "ra_hir 0.1.0", 648 "ra_hir 0.1.0",
649 "ra_ide_api_light 0.1.0",
650 "ra_syntax 0.1.0", 650 "ra_syntax 0.1.0",
651 "ra_text_edit 0.1.0", 651 "ra_text_edit 0.1.0",
652 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 652 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -668,7 +668,7 @@ dependencies = [
668 "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 668 "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)", 669 "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)", 670 "join_to_string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
671 "ra_editor 0.1.0", 671 "ra_ide_api_light 0.1.0",
672 "ra_syntax 0.1.0", 672 "ra_syntax 0.1.0",
673 "tools 0.1.0", 673 "tools 0.1.0",
674] 674]
@@ -687,20 +687,6 @@ dependencies = [
687] 687]
688 688
689[[package]] 689[[package]]
690name = "ra_editor"
691version = "0.1.0"
692dependencies = [
693 "itertools 0.8.0 (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)",
695 "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
696 "ra_syntax 0.1.0",
697 "ra_text_edit 0.1.0",
698 "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)",
700 "test_utils 0.1.0",
701]
702
703[[package]]
704name = "ra_hir" 690name = "ra_hir"
705version = "0.1.0" 691version = "0.1.0"
706dependencies = [ 692dependencies = [
@@ -719,6 +705,20 @@ dependencies = [
719] 705]
720 706
721[[package]] 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]
720
721[[package]]
722name = "ra_lsp_server" 722name = "ra_lsp_server"
723version = "0.1.0" 723version = "0.1.0"
724dependencies = [ 724dependencies = [
@@ -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_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml
index 11c78ced8..3c0814279 100644
--- a/crates/ra_analysis/Cargo.toml
+++ b/crates/ra_analysis/Cargo.toml
@@ -16,7 +16,7 @@ parking_lot = "0.7.0"
16unicase = "2.2.0" 16unicase = "2.2.0"
17 17
18ra_syntax = { path = "../ra_syntax" } 18ra_syntax = { path = "../ra_syntax" }
19ra_editor = { path = "../ra_editor" } 19ra_ide_api_light = { path = "../ra_ide_api_light" }
20ra_text_edit = { path = "../ra_text_edit" } 20ra_text_edit = { path = "../ra_text_edit" }
21ra_db = { path = "../ra_db" } 21ra_db = { path = "../ra_db" }
22hir = { path = "../ra_hir", package = "ra_hir" } 22hir = { path = "../ra_hir", package = "ra_hir" }
diff --git a/crates/ra_analysis/src/extend_selection.rs b/crates/ra_analysis/src/extend_selection.rs
index 3b130f966..c3c809c9f 100644
--- a/crates/ra_analysis/src/extend_selection.rs
+++ b/crates/ra_analysis/src/extend_selection.rs
@@ -14,7 +14,7 @@ pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRang
14 if let Some(range) = extend_selection_in_macro(db, &source_file, frange) { 14 if let Some(range) = extend_selection_in_macro(db, &source_file, frange) {
15 return range; 15 return range;
16 } 16 }
17 ra_editor::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range) 17 ra_ide_api_light::extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range)
18} 18}
19 19
20fn extend_selection_in_macro( 20fn extend_selection_in_macro(
@@ -25,7 +25,7 @@ fn extend_selection_in_macro(
25 let macro_call = find_macro_call(source_file.syntax(), frange.range)?; 25 let macro_call = find_macro_call(source_file.syntax(), frange.range)?;
26 let (off, exp) = hir::MacroDef::ast_expand(macro_call)?; 26 let (off, exp) = hir::MacroDef::ast_expand(macro_call)?;
27 let dst_range = exp.map_range_forward(frange.range - off)?; 27 let dst_range = exp.map_range_forward(frange.range - off)?;
28 let dst_range = ra_editor::extend_selection(&exp.syntax(), dst_range)?; 28 let dst_range = ra_ide_api_light::extend_selection(&exp.syntax(), dst_range)?;
29 let src_range = exp.map_range_back(dst_range)? + off; 29 let src_range = exp.map_range_back(dst_range)? + off;
30 Some(src_range) 30 Some(src_range)
31} 31}
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 2b9963b3c..7c60ab7d6 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -6,7 +6,7 @@ use hir::{
6 self, Problem, source_binder, 6 self, Problem, source_binder,
7}; 7};
8use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; 8use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase};
9use ra_editor::{self, assists, LocalEdit, Severity}; 9use ra_ide_api_light::{self, assists, LocalEdit, Severity};
10use ra_syntax::{ 10use ra_syntax::{
11 TextRange, AstNode, SourceFile, 11 TextRange, AstNode, SourceFile,
12 ast::{self, NameOwner}, 12 ast::{self, NameOwner},
@@ -194,7 +194,7 @@ impl db::RootDatabase {
194 pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> { 194 pub(crate) fn diagnostics(&self, file_id: FileId) -> Cancelable<Vec<Diagnostic>> {
195 let syntax = self.source_file(file_id); 195 let syntax = self.source_file(file_id);
196 196
197 let mut res = ra_editor::diagnostics(&syntax) 197 let mut res = ra_ide_api_light::diagnostics(&syntax)
198 .into_iter() 198 .into_iter()
199 .map(|d| Diagnostic { 199 .map(|d| Diagnostic {
200 range: d.range, 200 range: d.range,
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 48df08416..183e36706 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -44,7 +44,7 @@ pub use crate::{
44 completion::{CompletionItem, CompletionItemKind, InsertText}, 44 completion::{CompletionItem, CompletionItemKind, InsertText},
45 runnables::{Runnable, RunnableKind}, 45 runnables::{Runnable, RunnableKind},
46}; 46};
47pub use ra_editor::{ 47pub use ra_ide_api_light::{
48 Fold, FoldKind, HighlightedRange, Severity, StructureNode, 48 Fold, FoldKind, HighlightedRange, Severity, StructureNode,
49 LineIndex, LineCol, translate_offset_with_edit, 49 LineIndex, LineCol, translate_offset_with_edit,
50}; 50};
@@ -336,25 +336,28 @@ impl Analysis {
336 /// Returns position of the mathcing brace (all types of braces are 336 /// Returns position of the mathcing brace (all types of braces are
337 /// supported). 337 /// supported).
338 pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> { 338 pub fn matching_brace(&self, file: &SourceFile, offset: TextUnit) -> Option<TextUnit> {
339 ra_editor::matching_brace(file, offset) 339 ra_ide_api_light::matching_brace(file, offset)
340 } 340 }
341 /// Returns a syntax tree represented as `String`, for debug purposes. 341 /// Returns a syntax tree represented as `String`, for debug purposes.
342 // FIXME: use a better name here. 342 // FIXME: use a better name here.
343 pub fn syntax_tree(&self, file_id: FileId) -> String { 343 pub fn syntax_tree(&self, file_id: FileId) -> String {
344 let file = self.db.source_file(file_id); 344 let file = self.db.source_file(file_id);
345 ra_editor::syntax_tree(&file) 345 ra_ide_api_light::syntax_tree(&file)
346 } 346 }
347 /// Returns an edit to remove all newlines in the range, cleaning up minor 347 /// Returns an edit to remove all newlines in the range, cleaning up minor
348 /// stuff like trailing commas. 348 /// stuff like trailing commas.
349 pub fn join_lines(&self, frange: FileRange) -> SourceChange { 349 pub fn join_lines(&self, frange: FileRange) -> SourceChange {
350 let file = self.db.source_file(frange.file_id); 350 let file = self.db.source_file(frange.file_id);
351 SourceChange::from_local_edit(frange.file_id, ra_editor::join_lines(&file, frange.range)) 351 SourceChange::from_local_edit(
352 frange.file_id,
353 ra_ide_api_light::join_lines(&file, frange.range),
354 )
352 } 355 }
353 /// Returns an edit which should be applied when opening a new line, fixing 356 /// Returns an edit which should be applied when opening a new line, fixing
354 /// up minor stuff like continuing the comment. 357 /// up minor stuff like continuing the comment.
355 pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> { 358 pub fn on_enter(&self, position: FilePosition) -> Option<SourceChange> {
356 let file = self.db.source_file(position.file_id); 359 let file = self.db.source_file(position.file_id);
357 let edit = ra_editor::on_enter(&file, position.offset)?; 360 let edit = ra_ide_api_light::on_enter(&file, position.offset)?;
358 Some(SourceChange::from_local_edit(position.file_id, edit)) 361 Some(SourceChange::from_local_edit(position.file_id, edit))
359 } 362 }
360 /// Returns an edit which should be applied after `=` was typed. Primarily, 363 /// Returns an edit which should be applied after `=` was typed. Primarily,
@@ -362,25 +365,25 @@ impl Analysis {
362 // FIXME: use a snippet completion instead of this hack here. 365 // FIXME: use a snippet completion instead of this hack here.
363 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { 366 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
364 let file = self.db.source_file(position.file_id); 367 let file = self.db.source_file(position.file_id);
365 let edit = ra_editor::on_eq_typed(&file, position.offset)?; 368 let edit = ra_ide_api_light::on_eq_typed(&file, position.offset)?;
366 Some(SourceChange::from_local_edit(position.file_id, edit)) 369 Some(SourceChange::from_local_edit(position.file_id, edit))
367 } 370 }
368 /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately. 371 /// Returns an edit which should be applied when a dot ('.') is typed on a blank line, indenting the line appropriately.
369 pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> { 372 pub fn on_dot_typed(&self, position: FilePosition) -> Option<SourceChange> {
370 let file = self.db.source_file(position.file_id); 373 let file = self.db.source_file(position.file_id);
371 let edit = ra_editor::on_dot_typed(&file, position.offset)?; 374 let edit = ra_ide_api_light::on_dot_typed(&file, position.offset)?;
372 Some(SourceChange::from_local_edit(position.file_id, edit)) 375 Some(SourceChange::from_local_edit(position.file_id, edit))
373 } 376 }
374 /// Returns a tree representation of symbols in the file. Useful to draw a 377 /// Returns a tree representation of symbols in the file. Useful to draw a
375 /// file outline. 378 /// file outline.
376 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> { 379 pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
377 let file = self.db.source_file(file_id); 380 let file = self.db.source_file(file_id);
378 ra_editor::file_structure(&file) 381 ra_ide_api_light::file_structure(&file)
379 } 382 }
380 /// Returns the set of folding ranges. 383 /// Returns the set of folding ranges.
381 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> { 384 pub fn folding_ranges(&self, file_id: FileId) -> Vec<Fold> {
382 let file = self.db.source_file(file_id); 385 let file = self.db.source_file(file_id);
383 ra_editor::folding_ranges(&file) 386 ra_ide_api_light::folding_ranges(&file)
384 } 387 }
385 /// Fuzzy searches for a symbol. 388 /// Fuzzy searches for a symbol.
386 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> { 389 pub fn symbol_search(&self, query: Query) -> Cancelable<Vec<NavigationTarget>> {
diff --git a/crates/ra_analysis/src/syntax_highlighting.rs b/crates/ra_analysis/src/syntax_highlighting.rs
index d2dc6cfbb..cb19e9515 100644
--- a/crates/ra_analysis/src/syntax_highlighting.rs
+++ b/crates/ra_analysis/src/syntax_highlighting.rs
@@ -1,22 +1,21 @@
1use ra_syntax::{ast, AstNode,}; 1use ra_syntax::{ast, AstNode,};
2use ra_editor::HighlightedRange;
3use ra_db::SyntaxDatabase; 2use ra_db::SyntaxDatabase;
4 3
5use crate::{ 4use crate::{
5 FileId, Cancelable, HighlightedRange,
6 db::RootDatabase, 6 db::RootDatabase,
7 FileId, Cancelable,
8}; 7};
9 8
10pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> { 9pub(crate) fn highlight(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<HighlightedRange>> {
11 let source_file = db.source_file(file_id); 10 let source_file = db.source_file(file_id);
12 let mut res = ra_editor::highlight(source_file.syntax()); 11 let mut res = ra_ide_api_light::highlight(source_file.syntax());
13 for macro_call in source_file 12 for macro_call in source_file
14 .syntax() 13 .syntax()
15 .descendants() 14 .descendants()
16 .filter_map(ast::MacroCall::cast) 15 .filter_map(ast::MacroCall::cast)
17 { 16 {
18 if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) { 17 if let Some((off, exp)) = hir::MacroDef::ast_expand(macro_call) {
19 let mapped_ranges = ra_editor::highlight(&exp.syntax()) 18 let mapped_ranges = ra_ide_api_light::highlight(&exp.syntax())
20 .into_iter() 19 .into_iter()
21 .filter_map(|r| { 20 .filter_map(|r| {
22 let mapped_range = exp.map_range_back(r.range)?; 21 let mapped_range = exp.map_range_back(r.range)?;
diff --git a/crates/ra_cli/Cargo.toml b/crates/ra_cli/Cargo.toml
index 83f1d91e0..eb1722d5e 100644
--- a/crates/ra_cli/Cargo.toml
+++ b/crates/ra_cli/Cargo.toml
@@ -10,5 +10,5 @@ clap = "2.32.0"
10failure = "0.1.4" 10failure = "0.1.4"
11join_to_string = "0.1.1" 11join_to_string = "0.1.1"
12ra_syntax = { path = "../ra_syntax" } 12ra_syntax = { path = "../ra_syntax" }
13ra_editor = { path = "../ra_editor" } 13ra_ide_api_light = { path = "../ra_ide_api_light" }
14tools = { path = "../tools" } 14tools = { path = "../tools" }
diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs
index 0d12f3a88..43fb2fc4c 100644
--- a/crates/ra_cli/src/main.rs
+++ b/crates/ra_cli/src/main.rs
@@ -2,7 +2,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
2 2
3use clap::{App, Arg, SubCommand}; 3use clap::{App, Arg, SubCommand};
4use join_to_string::join; 4use join_to_string::join;
5use ra_editor::{extend_selection, file_structure, syntax_tree}; 5use ra_ide_api_light::{extend_selection, file_structure, syntax_tree};
6use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode}; 6use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode};
7use tools::collect_tests; 7use tools::collect_tests;
8 8
diff --git a/crates/ra_ide_api_light/Cargo.toml b/crates/ra_ide_api_light/Cargo.toml
index a97d2308f..8c192fca6 100644
--- a/crates/ra_ide_api_light/Cargo.toml
+++ b/crates/ra_ide_api_light/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2edition = "2018" 2edition = "2018"
3name = "ra_editor" 3name = "ra_ide_api_light"
4version = "0.1.0" 4version = "0.1.0"
5authors = ["Aleksey Kladov <[email protected]>"] 5authors = ["Aleksey Kladov <[email protected]>"]
6publish = false 6publish = false
diff --git a/crates/ra_ide_api_light/src/lib.rs b/crates/ra_ide_api_light/src/lib.rs
index 5a6af19b7..40638eda8 100644
--- a/crates/ra_ide_api_light/src/lib.rs
+++ b/crates/ra_ide_api_light/src/lib.rs
@@ -1,3 +1,8 @@
1//! This crate provides thouse IDE features which use only a single file.
2//!
3//! This usually means functions which take sytnax tree as an input and produce
4//! an edit or some auxilarly info.
5
1pub mod assists; 6pub mod assists;
2mod extend_selection; 7mod extend_selection;
3mod folding_ranges; 8mod folding_ranges;