diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-30 13:45:49 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-30 13:45:49 +0100 |
commit | 671926ac93f0ff921758a919eaf87c056979189f (patch) | |
tree | 111c2cc751cb7fcca38eb7518e1d39af394ee243 /crates/ra_ide_db | |
parent | 9e12b9e6fdc03ea6bc35a88cfb5d5d6751672ec8 (diff) | |
parent | 4c897d8d2dd047e0906d585318866c9ae7a21610 (diff) |
Merge #3666
3666: Reload part of the server configuration without restarts r=matklad a=SomeoneToIgnore
Partially addresses https://github.com/rust-analyzer/rust-analyzer/issues/2857
Closes #3751
Reloads all server configuration that's not related to VFS without restarts.
The VFS-related parameters are not considered, since VFS is planned to be rewritten/replaced in the future and I have a suspicion that with the current code, swapping the VFS and the file watchers on the fly will cause big troubles.
I have to store and process the config request id separately, since the `workspace/configuration` response returns `any[]` (https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_configuration), if there's a better way to handle those responses, let me know.
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/crates/ra_ide_db/src/lib.rs b/crates/ra_ide_db/src/lib.rs index 4faeefa8d..e6f2d36e9 100644 --- a/crates/ra_ide_db/src/lib.rs +++ b/crates/ra_ide_db/src/lib.rs | |||
@@ -115,12 +115,16 @@ impl RootDatabase { | |||
115 | db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); | 115 | db.set_crate_graph_with_durability(Default::default(), Durability::HIGH); |
116 | db.set_local_roots_with_durability(Default::default(), Durability::HIGH); | 116 | db.set_local_roots_with_durability(Default::default(), Durability::HIGH); |
117 | db.set_library_roots_with_durability(Default::default(), Durability::HIGH); | 117 | db.set_library_roots_with_durability(Default::default(), Durability::HIGH); |
118 | let lru_capacity = lru_capacity.unwrap_or(ra_db::DEFAULT_LRU_CAP); | 118 | db.update_lru_capacity(lru_capacity); |
119 | db.query_mut(ra_db::ParseQuery).set_lru_capacity(lru_capacity); | ||
120 | db.query_mut(hir::db::ParseMacroQuery).set_lru_capacity(lru_capacity); | ||
121 | db.query_mut(hir::db::MacroExpandQuery).set_lru_capacity(lru_capacity); | ||
122 | db | 119 | db |
123 | } | 120 | } |
121 | |||
122 | pub fn update_lru_capacity(&mut self, lru_capacity: Option<usize>) { | ||
123 | let lru_capacity = lru_capacity.unwrap_or(ra_db::DEFAULT_LRU_CAP); | ||
124 | self.query_mut(ra_db::ParseQuery).set_lru_capacity(lru_capacity); | ||
125 | self.query_mut(hir::db::ParseMacroQuery).set_lru_capacity(lru_capacity); | ||
126 | self.query_mut(hir::db::MacroExpandQuery).set_lru_capacity(lru_capacity); | ||
127 | } | ||
124 | } | 128 | } |
125 | 129 | ||
126 | impl salsa::ParallelDatabase for RootDatabase { | 130 | impl salsa::ParallelDatabase for RootDatabase { |