mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Publish diagnostics on file open
Diagnostics are sometimes only showing up when typing. This should fix that.
This commit is contained in:
parent
db6988d4e7
commit
9ed883f373
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) {
|
if self.status == Status::Ready && (state_changed || prev_status == Status::Loading) {
|
||||||
let subscriptions = self
|
self.update_file_notifications_on_threadpool();
|
||||||
.mem_docs
|
|
||||||
.keys()
|
|
||||||
.map(|path| self.vfs.read().0.file_id(&path).unwrap())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
self.update_file_notifications_on_threadpool(subscriptions);
|
|
||||||
|
|
||||||
// Refresh semantic tokens if the client supports it.
|
// Refresh semantic tokens if the client supports it.
|
||||||
if self.config.semantic_tokens_refresh {
|
if self.config.semantic_tokens_refresh {
|
||||||
|
@ -498,6 +492,7 @@ impl GlobalState {
|
||||||
.write()
|
.write()
|
||||||
.0
|
.0
|
||||||
.set_file_contents(path, Some(params.text_document.text.into_bytes()));
|
.set_file_contents(path, Some(params.text_document.text.into_bytes()));
|
||||||
|
this.update_file_notifications_on_threadpool();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
})?
|
})?
|
||||||
|
@ -606,7 +601,13 @@ impl GlobalState {
|
||||||
.finish();
|
.finish();
|
||||||
Ok(())
|
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);
|
log::trace!("updating notifications for {:?}", subscriptions);
|
||||||
if self.config.publish_diagnostics {
|
if self.config.publish_diagnostics {
|
||||||
let snapshot = self.snapshot();
|
let snapshot = self.snapshot();
|
||||||
|
|
Loading…
Reference in a new issue