aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_cli/Cargo.toml1
-rw-r--r--crates/ra_cli/src/main.rs2
-rw-r--r--crates/ra_ide_api/Cargo.toml1
-rw-r--r--crates/ra_ide_api/src/lib.rs11
-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.toml26
-rw-r--r--crates/ra_ide_api_light/src/lib.rs12
-rw-r--r--crates/ra_syntax/src/ast.rs71
9 files changed, 41 insertions, 85 deletions
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
15ra_syntax = { path = "../ra_syntax" } 15ra_syntax = { path = "../ra_syntax" }
16ra_ide_api = { path = "../ra_ide_api" } 16ra_ide_api = { path = "../ra_ide_api" }
17ra_ide_api_light = { path = "../ra_ide_api_light" }
18tools = { path = "../tools" } 17tools = { path = "../tools" }
19ra_batch = { path = "../ra_batch" } 18ra_batch = { path = "../ra_batch" }
20ra_hir = { path = "../ra_hir" } 19ra_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};
5use clap::{App, Arg, SubCommand}; 5use clap::{App, Arg, SubCommand};
6use join_to_string::join; 6use join_to_string::join;
7use ra_ide_api::{Analysis, FileRange}; 7use ra_ide_api::{Analysis, FileRange};
8use ra_ide_api_light::file_structure; 8use ra_ide_api::file_structure;
9use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode}; 9use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode};
10use tools::collect_tests; 10use tools::collect_tests;
11use flexi_logger::Logger; 11use 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 }
20jemalloc-ctl = { version = "0.2.0", optional = true } 20jemalloc-ctl = { version = "0.2.0", optional = true }
21 21
22ra_syntax = { path = "../ra_syntax" } 22ra_syntax = { path = "../ra_syntax" }
23ra_ide_api_light = { path = "../ra_ide_api_light" }
24ra_text_edit = { path = "../ra_text_edit" } 23ra_text_edit = { path = "../ra_text_edit" }
25ra_db = { path = "../ra_db" } 24ra_db = { path = "../ra_db" }
26ra_fmt = { path = "../ra_fmt" } 25ra_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;
33mod assists; 30mod assists;
34mod diagnostics; 31mod diagnostics;
35mod syntax_tree; 32mod syntax_tree;
36mod line_index;
37mod folding_ranges; 33mod folding_ranges;
34mod line_index;
38mod line_index_utils; 35mod line_index_utils;
39mod join_lines; 36mod join_lines;
37mod structure;
40mod typing; 38mod typing;
41mod matching_brace; 39mod 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};
77pub use ra_ide_api_light::StructureNode; 76
78pub use ra_db::{ 77pub 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---
2created: "2019-02-05T22:03:50.763530100Z" 2created: "2019-02-05T22:03:50.763530100Z"
3creator: [email protected] 3creator: [email protected]
4source: crates/ra_ide_api_light/src/structure.rs 4source: crates/ra_ide_api/src/structure.rs
5expression: structure 5expression: 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]
2edition = "2018"
3name = "ra_ide_api_light"
4version = "0.1.0"
5authors = ["rust-analyzer developers"]
6publish = false
7
8[dependencies]
9itertools = "0.8.0"
10superslice = "1.0.0"
11join_to_string = "0.1.1"
12rustc-hash = "1.0"
13
14ra_syntax = { path = "../ra_syntax" }
15ra_text_edit = { path = "../ra_text_edit" }
16ra_fmt = { path = "../ra_fmt" }
17
18[dev-dependencies]
19test_utils = { path = "../test_utils" }
20insta = "0.7.0"
21
22[dev-dependencies.proptest]
23version = "0.9.0"
24# Disable `fork` feature to allow compiling on webassembly
25default-features = false
26features = ["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
6mod structure;
7
8use ra_syntax::TextRange;
9
10pub use crate::{
11 structure::{file_structure, StructureNode},
12};
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index 226208700..a6fac07c4 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -603,43 +603,40 @@ pub enum BinOp {
603 603
604impl BinExpr { 604impl BinExpr {
605 fn op_details(&self) -> Option<(&SyntaxNode, BinOp)> { 605 fn op_details(&self) -> Option<(&SyntaxNode, BinOp)> {
606 self.syntax() 606 self.syntax().children().find_map(|c| match c.kind() {
607 .children() 607 PIPEPIPE => Some((c, BinOp::BooleanOr)),
608 .filter_map(|c| match c.kind() { 608 AMPAMP => Some((c, BinOp::BooleanAnd)),
609 PIPEPIPE => Some((c, BinOp::BooleanOr)), 609 EQEQ => Some((c, BinOp::EqualityTest)),
610 AMPAMP => Some((c, BinOp::BooleanAnd)), 610 NEQ => Some((c, BinOp::NegatedEqualityTest)),
611 EQEQ => Some((c, BinOp::EqualityTest)), 611 LTEQ => Some((c, BinOp::LesserEqualTest)),
612 NEQ => Some((c, BinOp::NegatedEqualityTest)), 612 GTEQ => Some((c, BinOp::GreaterEqualTest)),
613 LTEQ => Some((c, BinOp::LesserEqualTest)), 613 L_ANGLE => Some((c, BinOp::LesserTest)),
614 GTEQ => Some((c, BinOp::GreaterEqualTest)), 614 R_ANGLE => Some((c, BinOp::GreaterTest)),
615 L_ANGLE => Some((c, BinOp::LesserTest)), 615 PLUS => Some((c, BinOp::Addition)),
616 R_ANGLE => Some((c, BinOp::GreaterTest)), 616 STAR => Some((c, BinOp::Multiplication)),
617 PLUS => Some((c, BinOp::Addition)), 617 MINUS => Some((c, BinOp::Subtraction)),
618 STAR => Some((c, BinOp::Multiplication)), 618 SLASH => Some((c, BinOp::Division)),
619 MINUS => Some((c, BinOp::Subtraction)), 619 PERCENT => Some((c, BinOp::Remainder)),
620 SLASH => Some((c, BinOp::Division)), 620 SHL => Some((c, BinOp::LeftShift)),
621 PERCENT => Some((c, BinOp::Remainder)), 621 SHR => Some((c, BinOp::RightShift)),
622 SHL => Some((c, BinOp::LeftShift)), 622 CARET => Some((c, BinOp::BitwiseXor)),
623 SHR => Some((c, BinOp::RightShift)), 623 PIPE => Some((c, BinOp::BitwiseOr)),
624 CARET => Some((c, BinOp::BitwiseXor)), 624 AMP => Some((c, BinOp::BitwiseAnd)),
625 PIPE => Some((c, BinOp::BitwiseOr)), 625 DOTDOT => Some((c, BinOp::RangeRightOpen)),
626 AMP => Some((c, BinOp::BitwiseAnd)), 626 DOTDOTEQ => Some((c, BinOp::RangeRightClosed)),
627 DOTDOT => Some((c, BinOp::RangeRightOpen)), 627 EQ => Some((c, BinOp::Assignment)),
628 DOTDOTEQ => Some((c, BinOp::RangeRightClosed)), 628 PLUSEQ => Some((c, BinOp::AddAssign)),
629 EQ => Some((c, BinOp::Assignment)), 629 SLASHEQ => Some((c, BinOp::DivAssign)),
630 PLUSEQ => Some((c, BinOp::AddAssign)), 630 STAREQ => Some((c, BinOp::MulAssign)),
631 SLASHEQ => Some((c, BinOp::DivAssign)), 631 PERCENTEQ => Some((c, BinOp::RemAssign)),
632 STAREQ => Some((c, BinOp::MulAssign)), 632 SHREQ => Some((c, BinOp::ShrAssign)),
633 PERCENTEQ => Some((c, BinOp::RemAssign)), 633 SHLEQ => Some((c, BinOp::ShlAssign)),
634 SHREQ => Some((c, BinOp::ShrAssign)), 634 MINUSEQ => Some((c, BinOp::SubAssign)),
635 SHLEQ => Some((c, BinOp::ShlAssign)), 635 PIPEEQ => Some((c, BinOp::BitOrAssign)),
636 MINUSEQ => Some((c, BinOp::SubAssign)), 636 AMPEQ => Some((c, BinOp::BitAndAssign)),
637 PIPEEQ => Some((c, BinOp::BitOrAssign)), 637 CARETEQ => Some((c, BinOp::BitXorAssign)),
638 AMPEQ => Some((c, BinOp::BitAndAssign)), 638 _ => None,
639 CARETEQ => Some((c, BinOp::BitXorAssign)), 639 })
640 _ => None,
641 })
642 .next()
643 } 640 }
644 641
645 pub fn op_kind(&self) -> Option<BinOp> { 642 pub fn op_kind(&self) -> Option<BinOp> {