diff options
-rw-r--r-- | crates/ra_project_model/src/project_json.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 2 | ||||
-rw-r--r-- | crates/rust-analyzer/src/reload.rs | 5 |
3 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_project_model/src/project_json.rs b/crates/ra_project_model/src/project_json.rs index 9fe1e2dcb..b0fe09333 100644 --- a/crates/ra_project_model/src/project_json.rs +++ b/crates/ra_project_model/src/project_json.rs | |||
@@ -10,7 +10,7 @@ use serde::{de, Deserialize}; | |||
10 | use stdx::split_delim; | 10 | use stdx::split_delim; |
11 | 11 | ||
12 | /// Roots and crates that compose this Rust project. | 12 | /// Roots and crates that compose this Rust project. |
13 | #[derive(Clone, Debug)] | 13 | #[derive(Clone, Debug, Eq, PartialEq)] |
14 | pub struct ProjectJson { | 14 | pub struct ProjectJson { |
15 | pub(crate) roots: Vec<Root>, | 15 | pub(crate) roots: Vec<Root>, |
16 | pub(crate) crates: Vec<Crate>, | 16 | pub(crate) crates: Vec<Crate>, |
@@ -18,14 +18,14 @@ pub struct ProjectJson { | |||
18 | 18 | ||
19 | /// A root points to the directory which contains Rust crates. rust-analyzer watches all files in | 19 | /// A root points to the directory which contains Rust crates. rust-analyzer watches all files in |
20 | /// all roots. Roots might be nested. | 20 | /// all roots. Roots might be nested. |
21 | #[derive(Clone, Debug)] | 21 | #[derive(Clone, Debug, Eq, PartialEq)] |
22 | pub struct Root { | 22 | pub struct Root { |
23 | pub(crate) path: AbsPathBuf, | 23 | pub(crate) path: AbsPathBuf, |
24 | } | 24 | } |
25 | 25 | ||
26 | /// A crate points to the root module of a crate and lists the dependencies of the crate. This is | 26 | /// A crate points to the root module of a crate and lists the dependencies of the crate. This is |
27 | /// useful in creating the crate graph. | 27 | /// useful in creating the crate graph. |
28 | #[derive(Clone, Debug)] | 28 | #[derive(Clone, Debug, Eq, PartialEq)] |
29 | pub struct Crate { | 29 | pub struct Crate { |
30 | pub(crate) root_module: AbsPathBuf, | 30 | pub(crate) root_module: AbsPathBuf, |
31 | pub(crate) edition: Edition, | 31 | pub(crate) edition: Edition, |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 6b17ce18b..6c311648a 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -44,7 +44,7 @@ pub struct Config { | |||
44 | pub root_path: AbsPathBuf, | 44 | pub root_path: AbsPathBuf, |
45 | } | 45 | } |
46 | 46 | ||
47 | #[derive(Debug, Clone)] | 47 | #[derive(Debug, Clone, Eq, PartialEq)] |
48 | pub enum LinkedProject { | 48 | pub enum LinkedProject { |
49 | ProjectManifest(ProjectManifest), | 49 | ProjectManifest(ProjectManifest), |
50 | InlineJsonProject(ProjectJson), | 50 | InlineJsonProject(ProjectJson), |
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index ec71f8b29..0c1fd1b8b 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs | |||
@@ -19,11 +19,14 @@ impl GlobalState { | |||
19 | if self.config.lru_capacity != old_config.lru_capacity { | 19 | if self.config.lru_capacity != old_config.lru_capacity { |
20 | self.analysis_host.update_lru_capacity(old_config.lru_capacity); | 20 | self.analysis_host.update_lru_capacity(old_config.lru_capacity); |
21 | } | 21 | } |
22 | if self.config.flycheck != old_config.flycheck { | 22 | if self.config.linked_projects != old_config.linked_projects { |
23 | self.reload() | ||
24 | } else if self.config.flycheck != old_config.flycheck { | ||
23 | self.reload_flycheck(); | 25 | self.reload_flycheck(); |
24 | } | 26 | } |
25 | } | 27 | } |
26 | pub(crate) fn reload(&mut self) { | 28 | pub(crate) fn reload(&mut self) { |
29 | log::info!("reloading projects: {:?}", self.config.linked_projects); | ||
27 | let workspaces = { | 30 | let workspaces = { |
28 | if self.config.linked_projects.is_empty() | 31 | if self.config.linked_projects.is_empty() |
29 | && self.config.notifications.cargo_toml_not_found | 32 | && self.config.notifications.cargo_toml_not_found |