Rename ra_ide -> ide

This commit is contained in:
Aleksey Kladov 2020-08-13 17:42:52 +02:00
parent fc34403018
commit 1b0c7701cc
96 changed files with 122 additions and 125 deletions

70
Cargo.lock generated
View file

@ -346,7 +346,7 @@ dependencies = [
[[package]] [[package]]
name = "expect" name = "expect"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"difference", "difference",
"once_cell", "once_cell",
@ -385,7 +385,7 @@ dependencies = [
[[package]] [[package]]
name = "flycheck" name = "flycheck"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"cargo_metadata", "cargo_metadata",
"crossbeam-channel", "crossbeam-channel",
@ -579,6 +579,30 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "ide"
version = "0.0.0"
dependencies = [
"assists",
"base_db",
"cfg",
"either",
"expect",
"hir",
"ide_db",
"indexmap",
"itertools",
"log",
"oorandom",
"profile",
"rustc-hash",
"ssr",
"stdx",
"syntax",
"test_utils",
"text_edit",
]
[[package]] [[package]]
name = "ide_db" name = "ide_db"
version = "0.0.0" version = "0.0.0"
@ -992,7 +1016,7 @@ dependencies = [
[[package]] [[package]]
name = "paths" name = "paths"
version = "0.1.0" version = "0.0.0"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
@ -1052,7 +1076,7 @@ dependencies = [
[[package]] [[package]]
name = "proc_macro_api" name = "proc_macro_api"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"jod-thread", "jod-thread",
@ -1119,30 +1143,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "ra_ide"
version = "0.1.0"
dependencies = [
"assists",
"base_db",
"cfg",
"either",
"expect",
"hir",
"ide_db",
"indexmap",
"itertools",
"log",
"oorandom",
"profile",
"rustc-hash",
"ssr",
"stdx",
"syntax",
"test_utils",
"text_edit",
]
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.3.1" version = "1.3.1"
@ -1213,7 +1213,7 @@ dependencies = [
[[package]] [[package]]
name = "rust-analyzer" name = "rust-analyzer"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base_db", "base_db",
@ -1225,6 +1225,7 @@ dependencies = [
"hir", "hir",
"hir_def", "hir_def",
"hir_ty", "hir_ty",
"ide",
"ide_db", "ide_db",
"itertools", "itertools",
"jod-thread", "jod-thread",
@ -1239,7 +1240,6 @@ dependencies = [
"proc_macro_srv", "proc_macro_srv",
"profile", "profile",
"project_model", "project_model",
"ra_ide",
"rayon", "rayon",
"rustc-hash", "rustc-hash",
"serde", "serde",
@ -1444,7 +1444,7 @@ dependencies = [
[[package]] [[package]]
name = "ssr" name = "ssr"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"base_db", "base_db",
"expect", "expect",
@ -1458,7 +1458,7 @@ dependencies = [
[[package]] [[package]]
name = "stdx" name = "stdx"
version = "0.1.0" version = "0.0.0"
[[package]] [[package]]
name = "syn" name = "syn"
@ -1515,7 +1515,7 @@ dependencies = [
[[package]] [[package]]
name = "test_utils" name = "test_utils"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"difference", "difference",
"rustc-hash", "rustc-hash",
@ -1729,7 +1729,7 @@ dependencies = [
[[package]] [[package]]
name = "vfs" name = "vfs"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"fst", "fst",
"paths", "paths",
@ -1738,7 +1738,7 @@ dependencies = [
[[package]] [[package]]
name = "vfs-notify" name = "vfs-notify"
version = "0.1.0" version = "0.0.0"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"jod-thread", "jod-thread",

View file

@ -39,7 +39,7 @@ https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frls-2.2E0
* Website: https://rust-analyzer.github.io/ * Website: https://rust-analyzer.github.io/
* Metrics: https://rust-analyzer.github.io/metrics/ * Metrics: https://rust-analyzer.github.io/metrics/
* API docs: https://rust-analyzer.github.io/rust-analyzer/ra_ide/ * API docs: https://rust-analyzer.github.io/rust-analyzer/ide/
## License ## License

View file

@ -1,4 +1,4 @@
//! base_db defines basic database traits. The concrete DB is defined by ra_ide. //! base_db defines basic database traits. The concrete DB is defined by ide.
mod cancellation; mod cancellation;
mod input; mod input;
pub mod fixture; pub mod fixture;

View file

@ -1,9 +1,9 @@
[package] [package]
name = "expect" name = "expect"
version = "0.1.0" version = "0.0.0"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0"
[lib] [lib]
doctest = false doctest = false
@ -11,4 +11,5 @@ doctest = false
[dependencies] [dependencies]
once_cell = "1" once_cell = "1"
difference = "2" difference = "2"
stdx = { path = "../stdx" } stdx = { path = "../stdx" }

View file

@ -1,9 +1,9 @@
[package] [package]
edition = "2018"
name = "flycheck" name = "flycheck"
version = "0.1.0" version = "0.0.0"
authors = ["rust-analyzer developers"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"]
edition = "2018"
[lib] [lib]
doctest = false doctest = false
@ -14,4 +14,5 @@ log = "0.4.8"
cargo_metadata = "0.11.1" cargo_metadata = "0.11.1"
serde_json = "1.0.48" serde_json = "1.0.48"
jod-thread = "0.1.1" jod-thread = "0.1.1"
toolchain = { path = "../toolchain" } toolchain = { path = "../toolchain" }

View file

@ -1,16 +1,13 @@
[package] [package]
edition = "2018" name = "ide"
name = "ra_ide" version = "0.0.0"
version = "0.1.0"
authors = ["rust-analyzer developers"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"]
edition = "2018"
[lib] [lib]
doctest = false doctest = false
[features]
wasm = []
[dependencies] [dependencies]
either = "1.5.3" either = "1.5.3"
indexmap = "1.3.2" indexmap = "1.3.2"
@ -20,7 +17,6 @@ rustc-hash = "1.1.0"
oorandom = "11.1.2" oorandom = "11.1.2"
stdx = { path = "../stdx" } stdx = { path = "../stdx" }
syntax = { path = "../syntax" } syntax = { path = "../syntax" }
text_edit = { path = "../text_edit" } text_edit = { path = "../text_edit" }
base_db = { path = "../base_db" } base_db = { path = "../base_db" }
@ -31,7 +27,7 @@ test_utils = { path = "../test_utils" }
assists = { path = "../assists" } assists = { path = "../assists" }
ssr = { path = "../ssr" } ssr = { path = "../ssr" }
# ra_ide should depend only on the top-level `hir` package. if you need # ide should depend only on the top-level `hir` package. if you need
# something from some `hir_xxx` subpackage, reexport the API via `hir`. # something from some `hir_xxx` subpackage, reexport the API via `hir`.
hir = { path = "../hir" } hir = { path = "../hir" }

View file

@ -1,4 +1,4 @@
//! ra_ide crate provides "ide-centric" APIs for the rust-analyzer. That is, //! ide crate provides "ide-centric" APIs for the rust-analyzer. That is,
//! it generally operates with files and text ranges, and returns results as //! it generally operates with files and text ranges, and returns results as
//! Strings, suitable for displaying to the human. //! Strings, suitable for displaying to the human.
//! //!

View file

@ -105,7 +105,7 @@ impl<T> Option<T> {
} }
"# "#
.trim(), .trim(),
expect_file!["crates/ra_ide/test_data/highlighting.html"], expect_file!["crates/ide/test_data/highlighting.html"],
false, false,
); );
} }
@ -128,7 +128,7 @@ fn bar() {
} }
"# "#
.trim(), .trim(),
expect_file!["crates/ra_ide/test_data/rainbow_highlighting.html"], expect_file!["crates/ide/test_data/rainbow_highlighting.html"],
true, true,
); );
} }
@ -181,7 +181,7 @@ fn main() {
); );
}"## }"##
.trim(), .trim(),
expect_file!["crates/ra_ide/test_data/highlight_injection.html"], expect_file!["crates/ide/test_data/highlight_injection.html"],
false, false,
); );
} }
@ -264,7 +264,7 @@ fn main() {
println!("{ничоси}", ничоси = 92); println!("{ничоси}", ничоси = 92);
}"# }"#
.trim(), .trim(),
expect_file!["crates/ra_ide/test_data/highlight_strings.html"], expect_file!["crates/ide/test_data/highlight_strings.html"],
false, false,
); );
} }
@ -337,7 +337,7 @@ fn main() {
} }
"# "#
.trim(), .trim(),
expect_file!["crates/ra_ide/test_data/highlight_unsafe.html"], expect_file!["crates/ide/test_data/highlight_unsafe.html"],
false, false,
); );
} }
@ -413,7 +413,7 @@ macro_rules! noop {
} }
"# "#
.trim(), .trim(),
expect_file!["crates/ra_ide/test_data/highlight_doctest.html"], expect_file!["crates/ide/test_data/highlight_doctest.html"],
false, false,
); );
} }
@ -430,7 +430,7 @@ fn test_extern_crate() {
//- /alloc/lib.rs //- /alloc/lib.rs
pub struct A pub struct A
"#, "#,
expect_file!["crates/ra_ide/test_data/highlight_extern_crate.html"], expect_file!["crates/ide/test_data/highlight_extern_crate.html"],
false, false,
); );
} }

View file

@ -25,6 +25,6 @@ text_edit = { path = "../text_edit" }
base_db = { path = "../base_db" } base_db = { path = "../base_db" }
profile = { path = "../profile" } profile = { path = "../profile" }
test_utils = { path = "../test_utils" } test_utils = { path = "../test_utils" }
# ra_ide should depend only on the top-level `hir` package. if you need # ide should depend only on the top-level `hir` package. if you need
# something from some `hir_xxx` subpackage, reexport the API via `hir`. # something from some `hir_xxx` subpackage, reexport the API via `hir`.
hir = { path = "../hir" } hir = { path = "../hir" }

View file

@ -243,7 +243,7 @@ impl NameRefClass {
} }
// Note: we don't have unit-tests for this rather important function. // Note: we don't have unit-tests for this rather important function.
// It is primarily exercised via goto definition tests in `ra_ide`. // It is primarily exercised via goto definition tests in `ide`.
pub fn classify_name_ref( pub fn classify_name_ref(
sema: &Semantics<RootDatabase>, sema: &Semantics<RootDatabase>,
name_ref: &ast::NameRef, name_ref: &ast::NameRef,

View file

@ -1,9 +1,9 @@
[package] [package]
name = "paths" name = "paths"
version = "0.1.0" version = "0.0.0"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0"
[lib] [lib]
doctest = false doctest = false

View file

@ -1,10 +1,9 @@
[package] [package]
edition = "2018"
name = "proc_macro_api" name = "proc_macro_api"
version = "0.1.0" version = "0.0.0"
authors = ["rust-analyzer developers"]
publish = false
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"]
edition = "2018"
[lib] [lib]
doctest = false doctest = false

View file

@ -1,10 +1,10 @@
[package] [package]
edition = "2018"
name = "rust-analyzer" name = "rust-analyzer"
version = "0.1.0" version = "0.0.0"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
autobins = false autobins = false
license = "MIT OR Apache-2.0" edition = "2018"
[lib] [lib]
doctest = false doctest = false
@ -30,12 +30,11 @@ serde_json = "1.0.48"
threadpool = "1.7.1" threadpool = "1.7.1"
rayon = "1.3.1" rayon = "1.3.1"
mimalloc = { version = "0.1.19", default-features = false, optional = true } mimalloc = { version = "0.1.19", default-features = false, optional = true }
lsp-server = "0.3.3"
stdx = { path = "../stdx" } stdx = { path = "../stdx" }
lsp-server = "0.3.3"
flycheck = { path = "../flycheck" } flycheck = { path = "../flycheck" }
ra_ide = { path = "../ra_ide" } ide = { path = "../ide" }
profile = { path = "../profile" } profile = { path = "../profile" }
project_model = { path = "../project_model" } project_model = { path = "../project_model" }
syntax = { path = "../syntax" } syntax = { path = "../syntax" }

View file

@ -1,8 +1,8 @@
//! See `CargoTargetSpec` //! See `CargoTargetSpec`
use cfg::CfgExpr; use cfg::CfgExpr;
use ide::{FileId, RunnableKind, TestId};
use project_model::{self, TargetKind}; use project_model::{self, TargetKind};
use ra_ide::{FileId, RunnableKind, TestId};
use vfs::AbsPathBuf; use vfs::AbsPathBuf;
use crate::{global_state::GlobalStateSnapshot, Result}; use crate::{global_state::GlobalStateSnapshot, Result};

View file

@ -10,7 +10,7 @@ mod ssr;
use std::io::Read; use std::io::Read;
use anyhow::Result; use anyhow::Result;
use ra_ide::Analysis; use ide::Analysis;
use syntax::{AstNode, SourceFile}; use syntax::{AstNode, SourceFile};
pub use self::{ pub use self::{

View file

@ -7,7 +7,7 @@ use base_db::{
salsa::{Database, Durability}, salsa::{Database, Durability},
FileId, FileId,
}; };
use ra_ide::{Analysis, AnalysisChange, AnalysisHost, CompletionConfig, FilePosition, LineCol}; use ide::{Analysis, AnalysisChange, AnalysisHost, CompletionConfig, FilePosition, LineCol};
use vfs::AbsPathBuf; use vfs::AbsPathBuf;
use crate::{ use crate::{

View file

@ -8,7 +8,7 @@ use rustc_hash::FxHashSet;
use base_db::SourceDatabaseExt; use base_db::SourceDatabaseExt;
use hir::Crate; use hir::Crate;
use ra_ide::Severity; use ide::Severity;
use crate::cli::{load_cargo::load_cargo, Result}; use crate::cli::{load_cargo::load_cargo, Result};

View file

@ -5,8 +5,8 @@ use std::{path::Path, sync::Arc};
use anyhow::Result; use anyhow::Result;
use base_db::CrateGraph; use base_db::CrateGraph;
use crossbeam_channel::{unbounded, Receiver}; use crossbeam_channel::{unbounded, Receiver};
use ide::{AnalysisChange, AnalysisHost};
use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace};
use ra_ide::{AnalysisChange, AnalysisHost};
use vfs::{loader::Handle, AbsPath, AbsPathBuf}; use vfs::{loader::Handle, AbsPath, AbsPathBuf};
use crate::reload::{ProjectFolders, SourceRootConfig}; use crate::reload::{ProjectFolders, SourceRootConfig};

View file

@ -10,9 +10,9 @@
use std::{ffi::OsString, path::PathBuf}; use std::{ffi::OsString, path::PathBuf};
use flycheck::FlycheckConfig; use flycheck::FlycheckConfig;
use ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig};
use lsp_types::ClientCapabilities; use lsp_types::ClientCapabilities;
use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest}; use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest};
use ra_ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig};
use serde::Deserialize; use serde::Deserialize;
use vfs::AbsPathBuf; use vfs::AbsPathBuf;

View file

@ -3,7 +3,7 @@ pub(crate) mod to_proto;
use std::{mem, sync::Arc}; use std::{mem, sync::Arc};
use ra_ide::FileId; use ide::FileId;
use rustc_hash::{FxHashMap, FxHashSet}; use rustc_hash::{FxHashMap, FxHashSet};
use crate::lsp_ext; use crate::lsp_ext;

View file

@ -2,7 +2,7 @@
use std::convert::TryFrom; use std::convert::TryFrom;
use base_db::{FileId, FilePosition, FileRange}; use base_db::{FileId, FilePosition, FileRange};
use ra_ide::{AssistKind, LineCol, LineIndex}; use ide::{AssistKind, LineCol, LineIndex};
use syntax::{TextRange, TextSize}; use syntax::{TextRange, TextSize};
use vfs::AbsPathBuf; use vfs::AbsPathBuf;

View file

@ -8,10 +8,10 @@ use std::{sync::Arc, time::Instant};
use base_db::{CrateId, VfsPath}; use base_db::{CrateId, VfsPath};
use crossbeam_channel::{unbounded, Receiver, Sender}; use crossbeam_channel::{unbounded, Receiver, Sender};
use flycheck::FlycheckHandle; use flycheck::FlycheckHandle;
use ide::{Analysis, AnalysisChange, AnalysisHost, FileId};
use lsp_types::{SemanticTokens, Url}; use lsp_types::{SemanticTokens, Url};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target};
use ra_ide::{Analysis, AnalysisChange, AnalysisHost, FileId};
use rustc_hash::FxHashMap; use rustc_hash::FxHashMap;
use crate::{ use crate::{

View file

@ -1,12 +1,16 @@
//! This module is responsible for implementing handlers for Language Server //! This module is responsible for implementing handlers for Language Server
//! Protocol. The majority of requests are fulfilled by calling into the //! Protocol. The majority of requests are fulfilled by calling into the
//! `ra_ide` crate. //! `ide` crate.
use std::{ use std::{
io::Write as _, io::Write as _,
process::{self, Stdio}, process::{self, Stdio},
}; };
use ide::{
FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query,
RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit,
};
use lsp_server::ErrorCode; use lsp_server::ErrorCode;
use lsp_types::{ use lsp_types::{
CallHierarchyIncomingCall, CallHierarchyIncomingCallsParams, CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyIncomingCallsParams, CallHierarchyItem,
@ -19,10 +23,6 @@ use lsp_types::{
TextDocumentIdentifier, Url, WorkspaceEdit, TextDocumentIdentifier, Url, WorkspaceEdit,
}; };
use project_model::TargetKind; use project_model::TargetKind;
use ra_ide::{
FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query,
RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit,
};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::to_value; use serde_json::to_value;
use stdx::{format_to, split_once}; use stdx::{format_to, split_once};
@ -212,7 +212,7 @@ pub(crate) fn handle_on_type_formatting(
let line_index = snap.analysis.file_line_index(position.file_id)?; let line_index = snap.analysis.file_line_index(position.file_id)?;
let line_endings = snap.file_line_endings(position.file_id); let line_endings = snap.file_line_endings(position.file_id);
// in `ra_ide`, the `on_type` invariant is that // in `ide`, the `on_type` invariant is that
// `text.char_at(position) == typed_char`. // `text.char_at(position) == typed_char`.
position.offset -= TextSize::of('.'); position.offset -= TextSize::of('.');
let char_typed = params.ch.chars().next().unwrap_or('\0'); let char_typed = params.ch.chars().next().unwrap_or('\0');

View file

@ -1,6 +1,6 @@
//! Implementation of the LSP for rust-analyzer. //! Implementation of the LSP for rust-analyzer.
//! //!
//! This crate takes Rust-specific analysis results from ra_ide and translates //! This crate takes Rust-specific analysis results from ide and translates
//! into LSP types. //! into LSP types.
//! //!
//! It also is the root of all state. `world` module defines the bulk of the //! It also is the root of all state. `world` module defines the bulk of the
@ -41,7 +41,7 @@ use serde::de::DeserializeOwned;
pub type Result<T, E = Box<dyn std::error::Error + Send + Sync>> = std::result::Result<T, E>; pub type Result<T, E = Box<dyn std::error::Error + Send + Sync>> = std::result::Result<T, E>;
pub use crate::{caps::server_capabilities, main_loop::main_loop}; pub use crate::{caps::server_capabilities, main_loop::main_loop};
use ra_ide::AnalysisHost; use ide::AnalysisHost;
use std::fmt; use std::fmt;
use vfs::Vfs; use vfs::Vfs;

View file

@ -2,8 +2,8 @@
use std::{error::Error, ops::Range}; use std::{error::Error, ops::Range};
use base_db::Canceled; use base_db::Canceled;
use ide::LineIndex;
use lsp_server::Notification; use lsp_server::Notification;
use ra_ide::LineIndex;
use crate::{from_proto, global_state::GlobalState}; use crate::{from_proto, global_state::GlobalState};

View file

@ -7,9 +7,9 @@ use std::{
use base_db::VfsPath; use base_db::VfsPath;
use crossbeam_channel::{select, Receiver}; use crossbeam_channel::{select, Receiver};
use ide::{Canceled, FileId};
use lsp_server::{Connection, Notification, Request, Response}; use lsp_server::{Connection, Notification, Request, Response};
use lsp_types::notification::Notification as _; use lsp_types::notification::Notification as _;
use ra_ide::{Canceled, FileId};
use crate::{ use crate::{
config::Config, config::Config,

View file

@ -3,8 +3,8 @@ use std::{mem, sync::Arc};
use base_db::{CrateGraph, SourceRoot, VfsPath}; use base_db::{CrateGraph, SourceRoot, VfsPath};
use flycheck::FlycheckHandle; use flycheck::FlycheckHandle;
use ide::AnalysisChange;
use project_model::{ProcMacroClient, ProjectWorkspace}; use project_model::{ProcMacroClient, ProjectWorkspace};
use ra_ide::AnalysisChange;
use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind};
use crate::{ use crate::{

View file

@ -5,13 +5,13 @@ use std::{
}; };
use base_db::{FileId, FileRange}; use base_db::{FileId, FileRange};
use itertools::Itertools; use ide::{
use ra_ide::{
Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation, Assist, AssistKind, CallInfo, CompletionItem, CompletionItemKind, Documentation,
FileSystemEdit, Fold, FoldKind, Highlight, HighlightModifier, HighlightTag, HighlightedRange, FileSystemEdit, Fold, FoldKind, Highlight, HighlightModifier, HighlightTag, HighlightedRange,
Indel, InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget, Indel, InlayHint, InlayKind, InsertTextFormat, LineIndex, Markup, NavigationTarget,
ReferenceAccess, ResolvedAssist, Runnable, Severity, SourceChange, SourceFileEdit, TextEdit, ReferenceAccess, ResolvedAssist, Runnable, Severity, SourceChange, SourceFileEdit, TextEdit,
}; };
use itertools::Itertools;
use syntax::{SyntaxKind, TextRange, TextSize}; use syntax::{SyntaxKind, TextRange, TextSize};
use crate::{ use crate::{
@ -761,7 +761,7 @@ pub(crate) fn markup_content(markup: Markup) -> lsp_types::MarkupContent {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use ra_ide::Analysis; use ide::Analysis;
use super::*; use super::*;

View file

@ -1,6 +1,6 @@
[package] [package]
name = "ssr" name = "ssr"
version = "0.1.0" version = "0.0.0"
description = "Structural search and replace of Rust code" description = "Structural search and replace of Rust code"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-analyzer/rust-analyzer" repository = "https://github.com/rust-analyzer/rust-analyzer"

View file

@ -1,9 +1,9 @@
[package] [package]
name = "stdx" name = "stdx"
version = "0.1.0" version = "0.0.0"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0"
[lib] [lib]
doctest = false doctest = false

View file

@ -1,9 +1,9 @@
[package] [package]
edition = "2018"
name = "test_utils" name = "test_utils"
version = "0.1.0" version = "0.0.0"
authors = ["rust-analyzer developers"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"]
edition = "2018"
[lib] [lib]
doctest = false doctest = false
@ -14,4 +14,5 @@ difference = "2.0.0"
text-size = "1.0.0" text-size = "1.0.0"
serde_json = "1.0.48" serde_json = "1.0.48"
rustc-hash = "1.1.0" rustc-hash = "1.1.0"
stdx = { path = "../stdx" } stdx = { path = "../stdx" }

View file

@ -1,9 +1,9 @@
[package] [package]
name = "vfs-notify" name = "vfs-notify"
version = "0.1.0" version = "0.0.0"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0"
[lib] [lib]
doctest = false doctest = false

View file

@ -1,9 +1,9 @@
[package] [package]
name = "vfs" name = "vfs"
version = "0.1.0" version = "0.0.0"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"] authors = ["rust-analyzer developers"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0"
[lib] [lib]
doctest = false doctest = false

View file

@ -14,7 +14,7 @@ To learn more about how rust-analyzer works, see
We also publish rustdoc docs to pages: We also publish rustdoc docs to pages:
https://rust-analyzer.github.io/rust-analyzer/ra_ide/ https://rust-analyzer.github.io/rust-analyzer/ide/
Various organizational and process issues are discussed in this document. Various organizational and process issues are discussed in this document.
@ -159,7 +159,7 @@ IDE should use only types from `hir`, and should not depend on the underling com
## IDE API ## IDE API
The main IDE crate (`ra_ide`) uses "Plain Old Data" for the API. The main IDE crate (`ide`) uses "Plain Old Data" for the API.
Rather than talking in definitions and references, it talks in Strings and textual offsets. Rather than talking in definitions and references, it talks in Strings and textual offsets.
In general, API is centered around UI concerns -- the result of the call is what the user sees in the editor, and not what the compiler sees underneath. In general, API is centered around UI concerns -- the result of the call is what the user sees in the editor, and not what the compiler sees underneath.
The results are 100% Rust specific though. The results are 100% Rust specific though.

View file

@ -118,7 +118,7 @@ directly query the database.
The top-level `hir` façade crate wraps ids into a more OO-flavored API. The top-level `hir` façade crate wraps ids into a more OO-flavored API.
### `crates/ra_ide` ### `crates/ide`
A stateful library for analyzing many Rust files as they change. `AnalysisHost` 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 is a mutable entity (clojure's atom) which holds the current state, incorporates
@ -136,11 +136,11 @@ offsets and strings as output. This works on top of rich code model powered by
### `crates/rust-analyzer` ### `crates/rust-analyzer`
An LSP implementation which wraps `ra_ide` into a language server protocol. An LSP implementation which wraps `ide` into a language server protocol.
### `ra_vfs` ### `ra_vfs`
Although `hir` and `ra_ide` don't do any IO, we need to be able to read Although `hir` and `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 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 manages overlays: "dirty" files in the editor, whose "true" contents is
different from data on disk. This is more or less the single really different from data on disk. This is more or less the single really
@ -161,7 +161,7 @@ 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 in a statically typed language, it's hard to make an error in the protocol
itself if messages are themselves typed. itself if messages are themselves typed.
The middle, and most important, boundary is `ra_ide`. Unlike The middle, and most important, boundary is `ide`. Unlike
`rust-analyzer`, which exposes API, `ide` uses Rust API and is intended to `rust-analyzer`, which exposes API, `ide` uses Rust API and is intended to
use by various tools. Typical test creates an `AnalysisHost`, calls some use by various tools. Typical test creates an `AnalysisHost`, calls some
`Analysis` functions and compares the results against expectation. `Analysis` functions and compares the results against expectation.

View file

@ -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 traits, etc. The "typed" API with Rust specific types is slightly lower in the
stack, we'll talk about it later. 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 [`AnalysisHost`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [`Analysis`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ide_api/src/lib.rs#L291-L478
The reason for this separation of `Analysis` and `AnalysisHost` is that we want to apply 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 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 "transaction", so it suffices to study its methods to understand all of the
input data. 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/ide_api/src/lib.rs#L119-L167
The `(add|change|remove)_file` methods control the set of the input files, where 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`) 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 `AnalysisHost` types are newtype wrappers for [`RootDatabase`] -- a salsa
database. 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/ide_api/src/db.rs#L88-L134
Salsa input queries are defined in [`FilesDatabase`] (which is a part of Salsa input queries are defined in [`FilesDatabase`] (which is a part of
`RootDatabase`). They closely mirror the familiar `AnalysisChange` structure: `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 [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 [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 [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 [ask analysis for completion]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [completion implementation]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [`CompletionContext`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 ["IntelliJ Trick"]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [find an ancestor `fn` node]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [semantic model]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [series of independent completion routines]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/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 [`complete_dot`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ide_api/src/completion/complete_dot.rs#L6-L22

View file

@ -194,7 +194,7 @@ impl TidyDocs {
let poorly_documented = [ let poorly_documented = [
"hir", "hir",
"hir_expand", "hir_expand",
"ra_ide", "ide",
"mbe", "mbe",
"parser", "parser",
"profile", "profile",