Skip to content

Commit 46f74e3

Browse files
bors[bot]matklad
andcommitted
471: rename crates to match reality r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 4f4f793 + 0c62b1b commit 46f74e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+132
-104
lines changed

ARCHITECTURE.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ More specifically, input data consists of a set of test files (`(PathBuf,
1515
String)` pairs) and an information about project structure, the so called
1616
`CrateGraph`. Crate graph specifies which files are crate roots, which cfg flags
1717
are specified for each crate (TODO: actually implement this) and what are
18-
dependencies between the crate. The analyzer keeps all these input data in
18+
dependencies between the crates. The analyzer keeps all these input data in
1919
memory and never does any IO. Because the input data is source code, which
2020
typically measures in tens of megabytes at most, keeping all input data in
2121
memory is OK.
@@ -74,9 +74,9 @@ notes.
7474
- `algo`: generic tree algorithms, including `walk` for O(1) stack
7575
space tree traversal (this is cool) and `visit` for type-driven
7676
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).
7878

79-
Test for ra_syntax are mostly data-driven: `tests/data/parser` contains a bunch of `.rs`
79+
Tests for ra_syntax are mostly data-driven: `tests/data/parser` contains a bunch of `.rs`
8080
(test vectors) and `.txt` files with corresponding syntax trees. During testing, we check
8181
`.rs` against `.txt`. If the `.txt` file is missing, it is created (this is how you update
8282
tests). Additionally, running `cargo gen-tests` will walk the grammar module and collect
@@ -107,41 +107,46 @@ guessing a HIR for a particular source position.
107107

108108
Underneath, HIR works on top of salsa, using a `HirDatabase` trait.
109109

110-
### `crates/ra_analysis`
110+
### `crates/ra_ide_api`
111111

112-
A stateful library for analyzing many Rust files as they change.
113-
`AnalysisHost` is a mutable entity (clojure's atom) which holds the
114-
current state, incorporates changes and handles out `Analysis` --- an
115-
immutable and consistent snapshot of world state at a point in time, which
116-
actually powers analysis.
112+
A stateful library for analyzing many Rust files as they change. `AnalysisHost`
113+
is a mutable entity (clojure's atom) which holds the current state, incorporates
114+
changes and handles out `Analysis` --- an immutable and consistent snapshot of
115+
world state at a point in time, which actually powers analysis.
117116

118-
One interesting aspect of analysis is its support for cancellation. When a change
119-
is applied to `AnalysisHost`, first all currently active snapshots are
117+
One interesting aspect of analysis is its support for cancellation. When a
118+
change is applied to `AnalysisHost`, first all currently active snapshots are
120119
cancelled. Only after all snapshots are dropped the change actually affects the
121120
database.
122121

123-
### `crates/ra_lsp_server`
124-
125-
An LSP implementation which uses `ra_analysis` for managing state and
126-
`ra_editor` for actually doing useful stuff.
127-
128-
See [#79](https://github.com/rust-analyzer/rust-analyzer/pull/79/) as an
129-
example of PR which adds a new feature to `ra_editor` and exposes it
130-
to `ra_lsp_server`.
122+
APIs in this crate are IDE centric: they take text offsets as input and produce
123+
offsets and strings as output. This works on top of rich code model powered by
124+
`hir`.
131125

132-
### `crates/ra_editor`
126+
### `crates/ra_ide_api_light`
133127

134-
All IDE features which can be implemented if you only have access to a
135-
single file. `ra_editor` could be used to enhance editing of Rust code
136-
without the need to fiddle with build-systems, file
137-
synchronization and such.
128+
All IDE features which can be implemented if you only have access to a single
129+
file. `ra_ide_api_light` could be used to enhance editing of Rust code without
130+
the need to fiddle with build-systems, file synchronization and such.
138131

139-
In a sense, `ra_editor` is just a bunch of pure functions which take a
132+
In a sense, `ra_ide_api_light` is just a bunch of pure functions which take a
140133
syntax tree as input.
141134

142-
The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread
135+
The tests for `ra_ide_api_light` are `#[cfg(test)] mod tests` unit-tests spread
143136
throughout its modules.
144137

138+
139+
### `crates/ra_lsp_server`
140+
141+
An LSP implementation which wraps `ra_ide_api` into a langauge server protocol.
142+
143+
### `crates/ra_vfs`
144+
145+
Although `hir` and `ra_ide_api` don't do any io, we need to be able to read
146+
files from disk at the end of the day. This is what `ra_vfs` does. It also
147+
manages overlays: "dirty" files in the editor, whose "true" contents is
148+
different from data on disk.
149+
145150
### `crates/gen_lsp_server`
146151

147152
A language server scaffold, exposing a synchronous crossbeam-channel based API.

Cargo.lock

Lines changed: 52 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ clap = "2.32.0"
1010
failure = "0.1.4"
1111
join_to_string = "0.1.1"
1212
ra_syntax = { path = "../ra_syntax" }
13-
ra_editor = { path = "../ra_editor" }
13+
ra_ide_api_light = { path = "../ra_ide_api_light" }
1414
tools = { path = "../tools" }

crates/ra_cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{fs, io::Read, path::Path, time::Instant};
22

33
use clap::{App, Arg, SubCommand};
44
use join_to_string::join;
5-
use ra_editor::{extend_selection, file_structure, syntax_tree};
5+
use ra_ide_api_light::{extend_selection, file_structure, syntax_tree};
66
use ra_syntax::{SourceFile, TextRange, TreePtr, AstNode};
77
use tools::collect_tests;
88

crates/ra_db/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
22
mod cancelation;
33
mod syntax_ptr;
44
mod input;

crates/ra_analysis/Cargo.toml renamed to crates/ra_ide_api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
edition = "2018"
3-
name = "ra_analysis"
3+
name = "ra_ide_api"
44
version = "0.1.0"
55
authors = ["Aleksey Kladov <[email protected]>"]
66

@@ -16,7 +16,7 @@ parking_lot = "0.7.0"
1616
unicase = "2.2.0"
1717

1818
ra_syntax = { path = "../ra_syntax" }
19-
ra_editor = { path = "../ra_editor" }
19+
ra_ide_api_light = { path = "../ra_ide_api_light" }
2020
ra_text_edit = { path = "../ra_text_edit" }
2121
ra_db = { path = "../ra_db" }
2222
hir = { path = "../ra_hir", package = "ra_hir" }

0 commit comments

Comments
 (0)