mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 08:36:03 +00:00
Merge #1019
1019: structure moved to ra_ide_api r=matklad a=pasa structure subtask for #1009 Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
This commit is contained in:
commit
958df1276e
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -929,7 +929,6 @@ dependencies = [
|
||||
"ra_db 0.1.0",
|
||||
"ra_hir 0.1.0",
|
||||
"ra_ide_api 0.1.0",
|
||||
"ra_ide_api_light 0.1.0",
|
||||
"ra_syntax 0.1.0",
|
||||
"tools 0.1.0",
|
||||
]
|
||||
@ -993,7 +992,6 @@ dependencies = [
|
||||
"ra_db 0.1.0",
|
||||
"ra_fmt 0.1.0",
|
||||
"ra_hir 0.1.0",
|
||||
"ra_ide_api_light 0.1.0",
|
||||
"ra_syntax 0.1.0",
|
||||
"ra_text_edit 0.1.0",
|
||||
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1004,22 +1002,6 @@ dependencies = [
|
||||
"unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra_ide_api_light"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"insta 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proptest 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ra_fmt 0.1.0",
|
||||
"ra_syntax 0.1.0",
|
||||
"ra_text_edit 0.1.0",
|
||||
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"superslice 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"test_utils 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra_lsp_server"
|
||||
version = "0.1.0"
|
||||
|
@ -14,7 +14,6 @@ indicatif = "0.11.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_ide_api = { path = "../ra_ide_api" }
|
||||
ra_ide_api_light = { path = "../ra_ide_api_light" }
|
||||
tools = { path = "../tools" }
|
||||
ra_batch = { path = "../ra_batch" }
|
||||
ra_hir = { path = "../ra_hir" }
|
||||
|
@ -5,7 +5,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
|
||||
use clap::{App, Arg, SubCommand};
|
||||
use join_to_string::join;
|
||||
use ra_ide_api::{Analysis, FileRange};
|
||||
use ra_ide_api_light::file_structure;
|
||||
use ra_ide_api::file_structure;
|
||||
use ra_syntax::{SourceFile, TextRange, TreeArc, AstNode};
|
||||
use tools::collect_tests;
|
||||
use flexi_logger::Logger;
|
||||
|
@ -20,7 +20,6 @@ jemallocator = { version = "0.1.9", optional = true }
|
||||
jemalloc-ctl = { version = "0.2.0", optional = true }
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_ide_api_light = { path = "../ra_ide_api_light" }
|
||||
ra_text_edit = { path = "../ra_text_edit" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
ra_fmt = { path = "../ra_fmt" }
|
||||
|
@ -6,9 +6,6 @@
|
||||
//! database, and the `ra_hir` crate, where majority of the analysis happens.
|
||||
//! However, IDE specific bits of the analysis (most notably completion) happen
|
||||
//! in this crate.
|
||||
//!
|
||||
//! The sibling `ra_ide_api_light` handles those bits of IDE functionality
|
||||
//! which are restricted to a single file and need only syntax.
|
||||
|
||||
// For proving that RootDatabase is RefUnwindSafe.
|
||||
#![recursion_limit = "128"]
|
||||
@ -33,10 +30,11 @@ mod impls;
|
||||
mod assists;
|
||||
mod diagnostics;
|
||||
mod syntax_tree;
|
||||
mod line_index;
|
||||
mod folding_ranges;
|
||||
mod line_index;
|
||||
mod line_index_utils;
|
||||
mod join_lines;
|
||||
mod structure;
|
||||
mod typing;
|
||||
mod matching_brace;
|
||||
|
||||
@ -72,9 +70,10 @@ pub use crate::{
|
||||
line_index_utils::translate_offset_with_edit,
|
||||
folding_ranges::{Fold, FoldKind},
|
||||
syntax_highlighting::HighlightedRange,
|
||||
structure::{StructureNode, file_structure},
|
||||
diagnostics::Severity,
|
||||
};
|
||||
pub use ra_ide_api_light::StructureNode;
|
||||
|
||||
pub use ra_db::{
|
||||
Canceled, CrateGraph, CrateId, FileId, FilePosition, FileRange, SourceRootId,
|
||||
Edition
|
||||
@ -388,7 +387,7 @@ impl Analysis {
|
||||
/// file outline.
|
||||
pub fn file_structure(&self, file_id: FileId) -> Vec<StructureNode> {
|
||||
let file = self.db.parse(file_id);
|
||||
ra_ide_api_light::file_structure(&file)
|
||||
structure::file_structure(&file)
|
||||
}
|
||||
|
||||
/// Returns the set of folding ranges.
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
created: "2019-02-05T22:03:50.763530100Z"
|
||||
creator: insta@0.6.1
|
||||
source: crates/ra_ide_api_light/src/structure.rs
|
||||
source: crates/ra_ide_api/src/structure.rs
|
||||
expression: structure
|
||||
---
|
||||
[
|
@ -1,26 +0,0 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "ra_ide_api_light"
|
||||
version = "0.1.0"
|
||||
authors = ["rust-analyzer developers"]
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.8.0"
|
||||
superslice = "1.0.0"
|
||||
join_to_string = "0.1.1"
|
||||
rustc-hash = "1.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_text_edit = { path = "../ra_text_edit" }
|
||||
ra_fmt = { path = "../ra_fmt" }
|
||||
|
||||
[dev-dependencies]
|
||||
test_utils = { path = "../test_utils" }
|
||||
insta = "0.7.0"
|
||||
|
||||
[dev-dependencies.proptest]
|
||||
version = "0.9.0"
|
||||
# Disable `fork` feature to allow compiling on webassembly
|
||||
default-features = false
|
||||
features = ["std", "bit-set", "break-dead-code"]
|
@ -1,12 +0,0 @@
|
||||
//! This crate provides those IDE features which use only a single file.
|
||||
//!
|
||||
//! This usually means functions which take syntax tree as an input and produce
|
||||
//! an edit or some auxiliary info.
|
||||
|
||||
mod structure;
|
||||
|
||||
use ra_syntax::TextRange;
|
||||
|
||||
pub use crate::{
|
||||
structure::{file_structure, StructureNode},
|
||||
};
|
@ -130,19 +130,6 @@ APIs in this crate are IDE centric: they take text offsets as input and produce
|
||||
offsets and strings as output. This works on top of rich code model powered by
|
||||
`hir`.
|
||||
|
||||
### `crates/ra_ide_api_light`
|
||||
|
||||
All IDE features which can be implemented if you only have access to a single
|
||||
file. `ra_ide_api_light` could be used to enhance editing of Rust code without
|
||||
the need to fiddle with build-systems, file synchronization and such.
|
||||
|
||||
In a sense, `ra_ide_api_light` is just a bunch of pure functions which take a
|
||||
syntax tree as input.
|
||||
|
||||
The tests for `ra_ide_api_light` are `#[cfg(test)] mod tests` unit-tests spread
|
||||
throughout its modules.
|
||||
|
||||
|
||||
### `crates/ra_lsp_server`
|
||||
|
||||
An LSP implementation which wraps `ra_ide_api` into a langauge server protocol.
|
||||
|
Loading…
Reference in New Issue
Block a user