Merge #7177
7177: Speed up snapshoting r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
ed732e86eb
@ -67,7 +67,7 @@ pub(crate) struct GlobalState {
|
||||
pub(crate) flycheck: Vec<FlycheckHandle>,
|
||||
pub(crate) flycheck_sender: Sender<flycheck::Message>,
|
||||
pub(crate) flycheck_receiver: Receiver<flycheck::Message>,
|
||||
pub(crate) config: Config,
|
||||
pub(crate) config: Arc<Config>,
|
||||
pub(crate) analysis_host: AnalysisHost,
|
||||
pub(crate) diagnostics: DiagnosticCollection,
|
||||
pub(crate) mem_docs: FxHashMap<VfsPath, DocumentData>,
|
||||
@ -83,7 +83,7 @@ pub(crate) struct GlobalState {
|
||||
|
||||
/// An immutable snapshot of the world's state at a point in time.
|
||||
pub(crate) struct GlobalStateSnapshot {
|
||||
pub(crate) config: Config,
|
||||
pub(crate) config: Arc<Config>,
|
||||
pub(crate) analysis: Analysis,
|
||||
pub(crate) check_fixes: CheckFixes,
|
||||
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
|
||||
@ -119,7 +119,7 @@ pub(crate) fn new(sender: Sender<lsp_server::Message>, config: Config) -> Global
|
||||
flycheck: Vec::new(),
|
||||
flycheck_sender,
|
||||
flycheck_receiver,
|
||||
config,
|
||||
config: Arc::new(config),
|
||||
analysis_host,
|
||||
diagnostics: Default::default(),
|
||||
mem_docs: FxHashMap::default(),
|
||||
@ -184,7 +184,7 @@ pub(crate) fn process_changes(&mut self) -> bool {
|
||||
|
||||
pub(crate) fn snapshot(&self) -> GlobalStateSnapshot {
|
||||
GlobalStateSnapshot {
|
||||
config: self.config.clone(),
|
||||
config: Arc::clone(&self.config),
|
||||
workspaces: Arc::clone(&self.workspaces),
|
||||
analysis: self.analysis_host.analysis(),
|
||||
vfs: Arc::clone(&self.vfs),
|
||||
|
@ -609,7 +609,7 @@ fn on_notification(&mut self, not: Notification) -> Result<()> {
|
||||
if let Some(json) = configs.get_mut(0) {
|
||||
// Note that json can be null according to the spec if the client can't
|
||||
// provide a configuration. This is handled in Config::update below.
|
||||
let mut config = this.config.clone();
|
||||
let mut config = Config::clone(&*this.config);
|
||||
config.update(json.take());
|
||||
this.update_configuration(config);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
impl GlobalState {
|
||||
pub(crate) fn update_configuration(&mut self, config: Config) {
|
||||
let _p = profile::span("GlobalState::update_configuration");
|
||||
let old_config = mem::replace(&mut self.config, config);
|
||||
let old_config = mem::replace(&mut self.config, Arc::new(config));
|
||||
if self.config.lru_capacity() != old_config.lru_capacity() {
|
||||
self.analysis_host.update_lru_capacity(self.config.lru_capacity());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user