mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Merge #6637
6637: Publish diagnostics on file open r=jonas-schievink a=jonas-schievink Diagnostics are sometimes only showing up when typing. This should fix that. Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6381 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
0bcd8147ec
1 changed files with 9 additions and 8 deletions
|
@ -348,13 +348,7 @@ impl GlobalState {
|
|||
}
|
||||
|
||||
if self.status == Status::Ready && (state_changed || prev_status == Status::Loading) {
|
||||
let subscriptions = self
|
||||
.mem_docs
|
||||
.keys()
|
||||
.map(|path| self.vfs.read().0.file_id(&path).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
self.update_file_notifications_on_threadpool(subscriptions);
|
||||
self.update_file_notifications_on_threadpool();
|
||||
|
||||
// Refresh semantic tokens if the client supports it.
|
||||
if self.config.semantic_tokens_refresh {
|
||||
|
@ -498,6 +492,7 @@ impl GlobalState {
|
|||
.write()
|
||||
.0
|
||||
.set_file_contents(path, Some(params.text_document.text.into_bytes()));
|
||||
this.update_file_notifications_on_threadpool();
|
||||
}
|
||||
Ok(())
|
||||
})?
|
||||
|
@ -606,7 +601,13 @@ impl GlobalState {
|
|||
.finish();
|
||||
Ok(())
|
||||
}
|
||||
fn update_file_notifications_on_threadpool(&mut self, subscriptions: Vec<FileId>) {
|
||||
fn update_file_notifications_on_threadpool(&mut self) {
|
||||
let subscriptions = self
|
||||
.mem_docs
|
||||
.keys()
|
||||
.map(|path| self.vfs.read().0.file_id(&path).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
log::trace!("updating notifications for {:?}", subscriptions);
|
||||
if self.config.publish_diagnostics {
|
||||
let snapshot = self.snapshot();
|
||||
|
|
Loading…
Reference in a new issue