mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 13:18:47 +00:00
rename ra_ide_api -> ra_ide
This commit is contained in:
parent
d9a36a736b
commit
757e593b25
81 changed files with 48 additions and 48 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -906,7 +906,7 @@ dependencies = [
|
|||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ra_db 0.1.0",
|
||||
"ra_hir 0.1.0",
|
||||
"ra_ide_api 0.1.0",
|
||||
"ra_ide 0.1.0",
|
||||
"ra_project_model 0.1.0",
|
||||
"ra_vfs 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ra_vfs_glob 0.1.0",
|
||||
|
@ -932,7 +932,7 @@ dependencies = [
|
|||
"ra_batch 0.1.0",
|
||||
"ra_db 0.1.0",
|
||||
"ra_hir 0.1.0",
|
||||
"ra_ide_api 0.1.0",
|
||||
"ra_ide 0.1.0",
|
||||
"ra_prof 0.1.0",
|
||||
"ra_syntax 0.1.0",
|
||||
]
|
||||
|
@ -1027,7 +1027,7 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra_ide_api"
|
||||
name = "ra_ide"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1065,7 +1065,7 @@ dependencies = [
|
|||
"lsp-server 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lsp-types 0.61.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ra_ide_api 0.1.0",
|
||||
"ra_ide 0.1.0",
|
||||
"ra_prof 0.1.0",
|
||||
"ra_project_model 0.1.0",
|
||||
"ra_syntax 0.1.0",
|
||||
|
|
|
@ -56,7 +56,7 @@ https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frls-2.2E0
|
|||
|
||||
## Quick Links
|
||||
|
||||
* API docs: https://rust-analyzer.github.io/rust-analyzer/ra_ide_api/
|
||||
* API docs: https://rust-analyzer.github.io/rust-analyzer/ra_ide/
|
||||
|
||||
|
||||
## License
|
||||
|
|
|
@ -15,6 +15,6 @@ crossbeam-channel = "0.4.0"
|
|||
ra_vfs = "0.5.0"
|
||||
ra_vfs_glob = { path = "../ra_vfs_glob" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
ra_ide_api = { path = "../ra_ide_api" }
|
||||
ra_ide = { path = "../ra_ide" }
|
||||
ra_hir = { path = "../ra_hir" }
|
||||
ra_project_model = { path = "../ra_project_model" }
|
||||
|
|
|
@ -6,7 +6,7 @@ use rustc_hash::FxHashMap;
|
|||
|
||||
use crossbeam_channel::{unbounded, Receiver};
|
||||
use ra_db::{CrateGraph, FileId, SourceRootId};
|
||||
use ra_ide_api::{AnalysisChange, AnalysisHost, FeatureFlags};
|
||||
use ra_ide::{AnalysisChange, AnalysisHost, FeatureFlags};
|
||||
use ra_project_model::{get_rustc_cfg_options, PackageRoot, ProjectWorkspace};
|
||||
use ra_vfs::{RootEntry, Vfs, VfsChange, VfsTask, Watch};
|
||||
use ra_vfs_glob::RustPackageFilterBuilder;
|
||||
|
|
|
@ -10,7 +10,7 @@ pico-args = "0.3.0"
|
|||
flexi_logger = "0.14.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_ide_api = { path = "../ra_ide_api" }
|
||||
ra_ide = { path = "../ra_ide" }
|
||||
ra_batch = { path = "../ra_batch" }
|
||||
ra_hir = { path = "../ra_hir" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
|
|
|
@ -10,7 +10,7 @@ use ra_db::{
|
|||
salsa::{Database, Durability},
|
||||
FileId, SourceDatabaseExt,
|
||||
};
|
||||
use ra_ide_api::{Analysis, AnalysisChange, AnalysisHost, FilePosition, LineCol};
|
||||
use ra_ide::{Analysis, AnalysisChange, AnalysisHost, FilePosition, LineCol};
|
||||
|
||||
use crate::Result;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::{error::Error, fmt::Write, io::Read};
|
|||
|
||||
use flexi_logger::Logger;
|
||||
use pico_args::Arguments;
|
||||
use ra_ide_api::{file_structure, Analysis};
|
||||
use ra_ide::{file_structure, Analysis};
|
||||
use ra_prof::profile;
|
||||
use ra_syntax::{AstNode, SourceFile};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! ra_db defines basic database traits. The concrete DB is defined by ra_ide_api.
|
||||
//! ra_db defines basic database traits. The concrete DB is defined by ra_ide.
|
||||
mod cancellation;
|
||||
mod input;
|
||||
pub mod fixture;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "ra_ide_api"
|
||||
name = "ra_ide"
|
||||
version = "0.1.0"
|
||||
authors = ["rust-analyzer developers"]
|
||||
|
||||
|
@ -32,7 +32,7 @@ ra_prof = { path = "../ra_prof" }
|
|||
test_utils = { path = "../test_utils" }
|
||||
ra_assists = { path = "../ra_assists" }
|
||||
|
||||
# ra_ide_api should depend only on the top-level `hir` package. if you need
|
||||
# ra_ide should depend only on the top-level `hir` package. if you need
|
||||
# something from some `hir_xxx` subpackage, reexport the API via `hir`.
|
||||
hir = { path = "../ra_hir", package = "ra_hir" }
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//! ra_ide_api crate provides "ide-centric" APIs for the rust-analyzer. That is,
|
||||
//! ra_ide crate provides "ide-centric" APIs for the rust-analyzer. That is,
|
||||
//! it generally operates with files and text ranges, and returns results as
|
||||
//! Strings, suitable for displaying to the human.
|
||||
//!
|
|
@ -306,7 +306,7 @@ fn main() {
|
|||
"#
|
||||
.trim(),
|
||||
);
|
||||
let dst_file = project_dir().join("crates/ra_ide_api/src/snapshots/highlighting.html");
|
||||
let dst_file = project_dir().join("crates/ra_ide/src/snapshots/highlighting.html");
|
||||
let actual_html = &analysis.highlight_as_html(file_id, false).unwrap();
|
||||
let expected_html = &read_text(&dst_file);
|
||||
std::fs::write(dst_file, &actual_html).unwrap();
|
||||
|
@ -333,7 +333,7 @@ fn bar() {
|
|||
.trim(),
|
||||
);
|
||||
let dst_file =
|
||||
project_dir().join("crates/ra_ide_api/src/snapshots/rainbow_highlighting.html");
|
||||
project_dir().join("crates/ra_ide/src/snapshots/rainbow_highlighting.html");
|
||||
let actual_html = &analysis.highlight_as_html(file_id, true).unwrap();
|
||||
let expected_html = &read_text(&dst_file);
|
||||
std::fs::write(dst_file, &actual_html).unwrap();
|
|
@ -22,7 +22,7 @@ jod-thread = "0.1.0"
|
|||
ra_vfs = "0.5.0"
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_text_edit = { path = "../ra_text_edit" }
|
||||
ra_ide_api = { path = "../ra_ide_api" }
|
||||
ra_ide = { path = "../ra_ide" }
|
||||
lsp-server = "0.3.0"
|
||||
ra_project_model = { path = "../ra_project_model" }
|
||||
ra_prof = { path = "../ra_prof" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use ra_ide_api::{FileId, RunnableKind};
|
||||
use ra_ide::{FileId, RunnableKind};
|
||||
use ra_project_model::{self, ProjectWorkspace, TargetKind};
|
||||
|
||||
use crate::{world::WorldSnapshot, Result};
|
||||
|
|
|
@ -6,7 +6,7 @@ use lsp_types::{
|
|||
SymbolKind, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem,
|
||||
TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, WorkspaceEdit,
|
||||
};
|
||||
use ra_ide_api::{
|
||||
use ra_ide::{
|
||||
translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition,
|
||||
FileRange, FileSystemEdit, Fold, FoldKind, InsertTextFormat, LineCol, LineIndex,
|
||||
NavigationTarget, RangeInfo, Severity, SourceChange, SourceFileEdit,
|
||||
|
@ -173,7 +173,7 @@ impl ConvWith<&LineIndex> for Range {
|
|||
}
|
||||
}
|
||||
|
||||
impl Conv for ra_ide_api::Documentation {
|
||||
impl Conv for ra_ide::Documentation {
|
||||
type Output = lsp_types::Documentation;
|
||||
fn conv(self) -> Documentation {
|
||||
Documentation::MarkupContent(MarkupContent {
|
||||
|
@ -183,7 +183,7 @@ impl Conv for ra_ide_api::Documentation {
|
|||
}
|
||||
}
|
||||
|
||||
impl Conv for ra_ide_api::FunctionSignature {
|
||||
impl Conv for ra_ide::FunctionSignature {
|
||||
type Output = lsp_types::SignatureInformation;
|
||||
fn conv(self) -> Self::Output {
|
||||
use lsp_types::{ParameterInformation, ParameterLabel, SignatureInformation};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Implementation of the LSP for rust-analyzer.
|
||||
//!
|
||||
//! This crate takes Rust-specific analysis results from ra_ide_api and
|
||||
//! This crate takes Rust-specific analysis results from ra_ide and
|
||||
//! translates into LSP types.
|
||||
//!
|
||||
//! It also is the root of all state. `world` module defines the bulk of the
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::{error::Error, fmt, panic, path::PathBuf, sync::Arc, time::Instant};
|
|||
use crossbeam_channel::{select, unbounded, RecvError, Sender};
|
||||
use lsp_server::{Connection, ErrorCode, Message, Notification, Request, RequestId, Response};
|
||||
use lsp_types::{ClientCapabilities, NumberOrString};
|
||||
use ra_ide_api::{Canceled, FeatureFlags, FileId, LibraryData, SourceRootId};
|
||||
use ra_ide::{Canceled, FeatureFlags, FileId, LibraryData, SourceRootId};
|
||||
use ra_prof::profile;
|
||||
use ra_vfs::{VfsTask, Watch};
|
||||
use relative_path::RelativePathBuf;
|
||||
|
|
|
@ -9,7 +9,7 @@ use lsp_types::{
|
|||
Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, PrepareRenameResponse,
|
||||
Range, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, WorkspaceEdit,
|
||||
};
|
||||
use ra_ide_api::{
|
||||
use ra_ide::{
|
||||
AssistId, FileId, FilePosition, FileRange, Query, Runnable, RunnableKind, SearchScope,
|
||||
};
|
||||
use ra_prof::profile;
|
||||
|
@ -162,7 +162,7 @@ pub fn handle_on_type_formatting(
|
|||
let line_index = world.analysis().file_line_index(position.file_id)?;
|
||||
let line_endings = world.file_line_endings(position.file_id);
|
||||
|
||||
// in `ra_ide_api`, the `on_type` invariant is that
|
||||
// in `ra_ide`, the `on_type` invariant is that
|
||||
// `text.char_at(position) == typed_char`.
|
||||
position.offset = position.offset - TextUnit::of_char('.');
|
||||
let char_typed = params.ch.chars().next().unwrap_or('\0');
|
||||
|
@ -894,7 +894,7 @@ pub fn handle_inlay_hints(
|
|||
label: api_type.label.to_string(),
|
||||
range: api_type.range.conv_with(&line_index),
|
||||
kind: match api_type.kind {
|
||||
ra_ide_api::InlayKind::TypeHint => InlayKind::TypeHint,
|
||||
ra_ide::InlayKind::TypeHint => InlayKind::TypeHint,
|
||||
},
|
||||
})
|
||||
.collect())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use ra_ide_api::FileId;
|
||||
use ra_ide::FileId;
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
|
|
|
@ -9,7 +9,7 @@ use crossbeam_channel::{unbounded, Receiver};
|
|||
use lsp_server::ErrorCode;
|
||||
use lsp_types::Url;
|
||||
use parking_lot::RwLock;
|
||||
use ra_ide_api::{
|
||||
use ra_ide::{
|
||||
Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData,
|
||||
SourceRootId,
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ To learn more about how rust-analyzer works, see
|
|||
|
||||
We also publish rustdoc docs to pages:
|
||||
|
||||
https://rust-analyzer.github.io/rust-analyzer/ra_ide_api/
|
||||
https://rust-analyzer.github.io/rust-analyzer/ra_ide/
|
||||
|
||||
Various organizational and process issues are discussed in this document.
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ guessing a HIR for a particular source position.
|
|||
|
||||
Underneath, HIR works on top of salsa, using a `HirDatabase` trait.
|
||||
|
||||
### `crates/ra_ide_api`
|
||||
### `crates/ra_ide`
|
||||
|
||||
A stateful library for analyzing many Rust files as they change. `AnalysisHost`
|
||||
is a mutable entity (clojure's atom) which holds the current state, incorporates
|
||||
|
@ -124,11 +124,11 @@ offsets and strings as output. This works on top of rich code model powered by
|
|||
|
||||
### `crates/ra_lsp_server`
|
||||
|
||||
An LSP implementation which wraps `ra_ide_api` into a language server protocol.
|
||||
An LSP implementation which wraps `ra_ide` into a language server protocol.
|
||||
|
||||
### `ra_vfs`
|
||||
|
||||
Although `hir` and `ra_ide_api` don't do any IO, we need to be able to read
|
||||
Although `hir` and `ra_ide` don't do any IO, we need to be able to read
|
||||
files from disk at the end of the day. This is what `ra_vfs` does. It also
|
||||
manages overlays: "dirty" files in the editor, whose "true" contents is
|
||||
different from data on disk. This is more or less the single really
|
||||
|
@ -162,13 +162,13 @@ disk. For this reason, we try to avoid writing too many tests on this boundary:
|
|||
in a statically typed language, it's hard to make an error in the protocol
|
||||
itself if messages are themselves typed.
|
||||
|
||||
The middle, and most important, boundary is `ra_ide_api`. Unlike
|
||||
`ra_lsp_server`, which exposes API, `ide_api` uses Rust API and is intended to
|
||||
The middle, and most important, boundary is `ra_ide`. Unlike
|
||||
`ra_lsp_server`, which exposes API, `ide` uses Rust API and is intended to
|
||||
use by various tools. Typical test creates an `AnalysisHost`, calls some
|
||||
`Analysis` functions and compares the results against expectation.
|
||||
|
||||
The innermost and most elaborate boundary is `hir`. It has a much richer
|
||||
vocabulary of types than `ide_api`, but the basic testing setup is the same: we
|
||||
vocabulary of types than `ide`, but the basic testing setup is the same: we
|
||||
create a database, run some queries, assert result.
|
||||
|
||||
For comparisons, we use [insta](https://github.com/mitsuhiko/insta/) library for
|
||||
|
|
|
@ -40,8 +40,8 @@ terms of files and offsets, and **not** in terms of Rust concepts like structs,
|
|||
traits, etc. The "typed" API with Rust specific types is slightly lower in the
|
||||
stack, we'll talk about it later.
|
||||
|
||||
[`AnalysisHost`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/lib.rs#L265-L284
|
||||
[`Analysis`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/lib.rs#L291-L478
|
||||
[`AnalysisHost`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/lib.rs#L265-L284
|
||||
[`Analysis`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/lib.rs#L291-L478
|
||||
|
||||
The reason for this separation of `Analysis` and `AnalysisHost` is that we want to apply
|
||||
changes "uniquely", but we might also want to fork an `Analysis` and send it to
|
||||
|
@ -69,7 +69,7 @@ the `AnalysisHost::apply_change` method, which accepts a single argument, a
|
|||
"transaction", so it suffices to study its methods to understand all of the
|
||||
input data.
|
||||
|
||||
[`AnalysisChange`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/lib.rs#L119-L167
|
||||
[`AnalysisChange`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/lib.rs#L119-L167
|
||||
|
||||
The `(add|change|remove)_file` methods control the set of the input files, where
|
||||
each file has an integer id (`FileId`, picked by the client), text (`String`)
|
||||
|
@ -253,7 +253,7 @@ All analyzer information is stored in a salsa database. `Analysis` and
|
|||
`AnalysisHost` types are newtype wrappers for [`RootDatabase`] -- a salsa
|
||||
database.
|
||||
|
||||
[`RootDatabase`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/db.rs#L88-L134
|
||||
[`RootDatabase`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/db.rs#L88-L134
|
||||
|
||||
Salsa input queries are defined in [`FilesDatabase`] (which is a part of
|
||||
`RootDatabase`). They closely mirror the familiar `AnalysisChange` structure:
|
||||
|
@ -565,11 +565,11 @@ the type to completion.
|
|||
[schedule it on the threadpool]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L428
|
||||
[catch]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L436-L442
|
||||
[the handler]: https://salsa.zulipchat.com/#narrow/stream/181542-rfcs.2Fsalsa-query-group/topic/design.20next.20steps
|
||||
[ask analysis for completion]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/lib.rs#L439-L444
|
||||
[completion implementation]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion.rs#L46-L62
|
||||
[`CompletionContext`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion/completion_context.rs#L14-L37
|
||||
["IntelliJ Trick"]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion/completion_context.rs#L72-L75
|
||||
[find an ancestor `fn` node]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion/completion_context.rs#L116-L120
|
||||
[semantic model]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion/completion_context.rs#L123
|
||||
[series of independent completion routines]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion.rs#L52-L59
|
||||
[`complete_dot`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion/complete_dot.rs#L6-L22
|
||||
[ask analysis for completion]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/lib.rs#L439-L444
|
||||
[completion implementation]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion.rs#L46-L62
|
||||
[`CompletionContext`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion/completion_context.rs#L14-L37
|
||||
["IntelliJ Trick"]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion/completion_context.rs#L72-L75
|
||||
[find an ancestor `fn` node]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion/completion_context.rs#L116-L120
|
||||
[semantic model]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion/completion_context.rs#L123
|
||||
[series of independent completion routines]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion.rs#L52-L59
|
||||
[`complete_dot`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_ide/src/completion/complete_dot.rs#L6-L22
|
||||
|
|
0
editors/code/src/utils/terminateProcess.sh
Executable file → Normal file
0
editors/code/src/utils/terminateProcess.sh
Executable file → Normal file
|
@ -74,7 +74,7 @@ fn no_docs_comments() {
|
|||
"ra_db",
|
||||
"ra_hir",
|
||||
"ra_hir_expand",
|
||||
"ra_ide_api",
|
||||
"ra_ide",
|
||||
"ra_lsp_server",
|
||||
"ra_mbe",
|
||||
"ra_parser",
|
||||
|
|
Loading…
Reference in a new issue