diff options
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 16 | ||||
-rw-r--r-- | crates/ra_project_model/src/project_json.rs (renamed from crates/ra_project_model/src/json_project.rs) | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 10 |
3 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index ac88532f0..7e8e00df8 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | mod cargo_workspace; | 3 | mod cargo_workspace; |
4 | mod json_project; | 4 | mod project_json; |
5 | mod sysroot; | 5 | mod sysroot; |
6 | 6 | ||
7 | use std::{ | 7 | use std::{ |
@@ -20,7 +20,7 @@ use serde_json::from_reader; | |||
20 | 20 | ||
21 | pub use crate::{ | 21 | pub use crate::{ |
22 | cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, | 22 | cargo_workspace::{CargoConfig, CargoWorkspace, Package, Target, TargetKind}, |
23 | json_project::JsonProject, | 23 | project_json::ProjectJson, |
24 | sysroot::Sysroot, | 24 | sysroot::Sysroot, |
25 | }; | 25 | }; |
26 | pub use ra_proc_macro::ProcMacroClient; | 26 | pub use ra_proc_macro::ProcMacroClient; |
@@ -30,7 +30,7 @@ pub enum ProjectWorkspace { | |||
30 | /// Project workspace was discovered by running `cargo metadata` and `rustc --print sysroot`. | 30 | /// Project workspace was discovered by running `cargo metadata` and `rustc --print sysroot`. |
31 | Cargo { cargo: CargoWorkspace, sysroot: Sysroot }, | 31 | Cargo { cargo: CargoWorkspace, sysroot: Sysroot }, |
32 | /// Project workspace was manually specified using a `rust-project.json` file. | 32 | /// Project workspace was manually specified using a `rust-project.json` file. |
33 | Json { project: JsonProject, project_location: AbsPathBuf }, | 33 | Json { project: ProjectJson, project_location: AbsPathBuf }, |
34 | } | 34 | } |
35 | 35 | ||
36 | /// `PackageRoot` describes a package root folder. | 36 | /// `PackageRoot` describes a package root folder. |
@@ -259,8 +259,8 @@ impl ProjectWorkspace { | |||
259 | let file_path = project_location.join(&krate.root_module); | 259 | let file_path = project_location.join(&krate.root_module); |
260 | let file_id = load(&file_path)?; | 260 | let file_id = load(&file_path)?; |
261 | let edition = match krate.edition { | 261 | let edition = match krate.edition { |
262 | json_project::Edition::Edition2015 => Edition::Edition2015, | 262 | project_json::Edition::Edition2015 => Edition::Edition2015, |
263 | json_project::Edition::Edition2018 => Edition::Edition2018, | 263 | project_json::Edition::Edition2018 => Edition::Edition2018, |
264 | }; | 264 | }; |
265 | let cfg_options = { | 265 | let cfg_options = { |
266 | let mut opts = CfgOptions::default(); | 266 | let mut opts = CfgOptions::default(); |
@@ -290,7 +290,7 @@ impl ProjectWorkspace { | |||
290 | .map(|it| proc_macro_client.by_dylib_path(&it)); | 290 | .map(|it| proc_macro_client.by_dylib_path(&it)); |
291 | // FIXME: No crate name in json definition such that we cannot add OUT_DIR to env | 291 | // FIXME: No crate name in json definition such that we cannot add OUT_DIR to env |
292 | Some(( | 292 | Some(( |
293 | json_project::CrateId(seq_index), | 293 | project_json::CrateId(seq_index), |
294 | crate_graph.add_crate_root( | 294 | crate_graph.add_crate_root( |
295 | file_id, | 295 | file_id, |
296 | edition, | 296 | edition, |
@@ -306,7 +306,7 @@ impl ProjectWorkspace { | |||
306 | 306 | ||
307 | for (id, krate) in project.crates.iter().enumerate() { | 307 | for (id, krate) in project.crates.iter().enumerate() { |
308 | for dep in &krate.deps { | 308 | for dep in &krate.deps { |
309 | let from_crate_id = json_project::CrateId(id); | 309 | let from_crate_id = project_json::CrateId(id); |
310 | let to_crate_id = dep.krate; | 310 | let to_crate_id = dep.krate; |
311 | if let (Some(&from), Some(&to)) = | 311 | if let (Some(&from), Some(&to)) = |
312 | (crates.get(&from_crate_id), crates.get(&to_crate_id)) | 312 | (crates.get(&from_crate_id), crates.get(&to_crate_id)) |
@@ -528,7 +528,7 @@ impl ProjectWorkspace { | |||
528 | ProjectWorkspace::Cargo { cargo, .. } => { | 528 | ProjectWorkspace::Cargo { cargo, .. } => { |
529 | Some(cargo.workspace_root()).filter(|root| path.starts_with(root)) | 529 | Some(cargo.workspace_root()).filter(|root| path.starts_with(root)) |
530 | } | 530 | } |
531 | ProjectWorkspace::Json { project: JsonProject { roots, .. }, .. } => roots | 531 | ProjectWorkspace::Json { project: ProjectJson { roots, .. }, .. } => roots |
532 | .iter() | 532 | .iter() |
533 | .find(|root| path.starts_with(&root.path)) | 533 | .find(|root| path.starts_with(&root.path)) |
534 | .map(|root| root.path.as_ref()), | 534 | .map(|root| root.path.as_ref()), |
diff --git a/crates/ra_project_model/src/json_project.rs b/crates/ra_project_model/src/project_json.rs index ee2de4c25..e663bb4d7 100644 --- a/crates/ra_project_model/src/json_project.rs +++ b/crates/ra_project_model/src/project_json.rs | |||
@@ -7,7 +7,7 @@ use serde::Deserialize; | |||
7 | 7 | ||
8 | /// Roots and crates that compose this Rust project. | 8 | /// Roots and crates that compose this Rust project. |
9 | #[derive(Clone, Debug, Deserialize)] | 9 | #[derive(Clone, Debug, Deserialize)] |
10 | pub struct JsonProject { | 10 | pub struct ProjectJson { |
11 | pub(crate) roots: Vec<Root>, | 11 | pub(crate) roots: Vec<Root>, |
12 | pub(crate) crates: Vec<Crate>, | 12 | pub(crate) crates: Vec<Crate>, |
13 | } | 13 | } |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 0be34c43f..7eded04c5 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -14,7 +14,7 @@ use lsp_types::ClientCapabilities; | |||
14 | use ra_db::AbsPathBuf; | 14 | use ra_db::AbsPathBuf; |
15 | use ra_flycheck::FlycheckConfig; | 15 | use ra_flycheck::FlycheckConfig; |
16 | use ra_ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig}; | 16 | use ra_ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig}; |
17 | use ra_project_model::{CargoConfig, JsonProject, ProjectManifest}; | 17 | use ra_project_model::{CargoConfig, ProjectJson, ProjectManifest}; |
18 | use serde::Deserialize; | 18 | use serde::Deserialize; |
19 | 19 | ||
20 | #[derive(Debug, Clone)] | 20 | #[derive(Debug, Clone)] |
@@ -47,7 +47,7 @@ pub struct Config { | |||
47 | #[derive(Debug, Clone)] | 47 | #[derive(Debug, Clone)] |
48 | pub enum LinkedProject { | 48 | pub enum LinkedProject { |
49 | ProjectManifest(ProjectManifest), | 49 | ProjectManifest(ProjectManifest), |
50 | InlineJsonProject(JsonProject), | 50 | InlineJsonProject(ProjectJson), |
51 | } | 51 | } |
52 | 52 | ||
53 | impl From<ProjectManifest> for LinkedProject { | 53 | impl From<ProjectManifest> for LinkedProject { |
@@ -56,8 +56,8 @@ impl From<ProjectManifest> for LinkedProject { | |||
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | impl From<JsonProject> for LinkedProject { | 59 | impl From<ProjectJson> for LinkedProject { |
60 | fn from(v: JsonProject) -> Self { | 60 | fn from(v: ProjectJson) -> Self { |
61 | LinkedProject::InlineJsonProject(v) | 61 | LinkedProject::InlineJsonProject(v) |
62 | } | 62 | } |
63 | } | 63 | } |
@@ -373,5 +373,5 @@ impl Config { | |||
373 | #[serde(untagged)] | 373 | #[serde(untagged)] |
374 | enum ManifestOrJsonProject { | 374 | enum ManifestOrJsonProject { |
375 | Manifest(PathBuf), | 375 | Manifest(PathBuf), |
376 | JsonProject(JsonProject), | 376 | JsonProject(ProjectJson), |
377 | } | 377 | } |