aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-06 12:49:50 +0000
committerGitHub <[email protected]>2021-01-06 12:49:50 +0000
commited732e86eb88393cdec471b263303adea6ffcb73 (patch)
tree9d76ac3477b73f1e84675ec3fee5428cb60d3075 /crates
parent66c575659e17035a747d3e4e10bcf4f3669a7143 (diff)
parent66ed821e18eadd3930a8621095c90b142763d517 (diff)
Merge #7177
7177: Speed up snapshoting r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/global_state.rs8
-rw-r--r--crates/rust-analyzer/src/main_loop.rs2
-rw-r--r--crates/rust-analyzer/src/reload.rs2
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 19ab4d596..1f6bf1c8c 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -67,7 +67,7 @@ pub(crate) struct GlobalState {
67 pub(crate) flycheck: Vec<FlycheckHandle>, 67 pub(crate) flycheck: Vec<FlycheckHandle>,
68 pub(crate) flycheck_sender: Sender<flycheck::Message>, 68 pub(crate) flycheck_sender: Sender<flycheck::Message>,
69 pub(crate) flycheck_receiver: Receiver<flycheck::Message>, 69 pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
70 pub(crate) config: Config, 70 pub(crate) config: Arc<Config>,
71 pub(crate) analysis_host: AnalysisHost, 71 pub(crate) analysis_host: AnalysisHost,
72 pub(crate) diagnostics: DiagnosticCollection, 72 pub(crate) diagnostics: DiagnosticCollection,
73 pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>, 73 pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>,
@@ -83,7 +83,7 @@ pub(crate) struct GlobalState {
83 83
84/// An immutable snapshot of the world's state at a point in time. 84/// An immutable snapshot of the world's state at a point in time.
85pub(crate) struct GlobalStateSnapshot { 85pub(crate) struct GlobalStateSnapshot {
86 pub(crate) config: Config, 86 pub(crate) config: Arc<Config>,
87 pub(crate) analysis: Analysis, 87 pub(crate) analysis: Analysis,
88 pub(crate) check_fixes: CheckFixes, 88 pub(crate) check_fixes: CheckFixes,
89 pub(crate) latest_requests: Arc<RwLock<LatestRequests>>, 89 pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
@@ -119,7 +119,7 @@ impl GlobalState {
119 flycheck: Vec::new(), 119 flycheck: Vec::new(),
120 flycheck_sender, 120 flycheck_sender,
121 flycheck_receiver, 121 flycheck_receiver,
122 config, 122 config: Arc::new(config),
123 analysis_host, 123 analysis_host,
124 diagnostics: Default::default(), 124 diagnostics: Default::default(),
125 mem_docs: FxHashMap::default(), 125 mem_docs: FxHashMap::default(),
@@ -184,7 +184,7 @@ impl GlobalState {
184 184
185 pub(crate) fn snapshot(&self) -> GlobalStateSnapshot { 185 pub(crate) fn snapshot(&self) -> GlobalStateSnapshot {
186 GlobalStateSnapshot { 186 GlobalStateSnapshot {
187 config: self.config.clone(), 187 config: Arc::clone(&self.config),
188 workspaces: Arc::clone(&self.workspaces), 188 workspaces: Arc::clone(&self.workspaces),
189 analysis: self.analysis_host.analysis(), 189 analysis: self.analysis_host.analysis(),
190 vfs: Arc::clone(&self.vfs), 190 vfs: Arc::clone(&self.vfs),
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 53f9546b8..7ac6acf70 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -609,7 +609,7 @@ impl GlobalState {
609 if let Some(json) = configs.get_mut(0) { 609 if let Some(json) = configs.get_mut(0) {
610 // Note that json can be null according to the spec if the client can't 610 // Note that json can be null according to the spec if the client can't
611 // provide a configuration. This is handled in Config::update below. 611 // provide a configuration. This is handled in Config::update below.
612 let mut config = this.config.clone(); 612 let mut config = Config::clone(&*this.config);
613 config.update(json.take()); 613 config.update(json.take());
614 this.update_configuration(config); 614 this.update_configuration(config);
615 } 615 }
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 51c24e966..76b50931a 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -18,7 +18,7 @@ use lsp_ext::StatusParams;
18impl GlobalState { 18impl GlobalState {
19 pub(crate) fn update_configuration(&mut self, config: Config) { 19 pub(crate) fn update_configuration(&mut self, config: Config) {
20 let _p = profile::span("GlobalState::update_configuration"); 20 let _p = profile::span("GlobalState::update_configuration");
21 let old_config = mem::replace(&mut self.config, config); 21 let old_config = mem::replace(&mut self.config, Arc::new(config));
22 if self.config.lru_capacity() != old_config.lru_capacity() { 22 if self.config.lru_capacity() != old_config.lru_capacity() {
23 self.analysis_host.update_lru_capacity(self.config.lru_capacity()); 23 self.analysis_host.update_lru_capacity(self.config.lru_capacity());
24 } 24 }