-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LS: Implement multithreaded diagnostics refreshing #6658
base: spr/main/b9bb403e
Are you sure you want to change the base?
Conversation
bb857da
to
93da297
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 6 files at r1, all commit messages.
Reviewable status: 2 of 6 files reviewed, 6 unresolved discussions (waiting on @Draggu, @mkaput, @orizi, and @piotmag769)
crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs
line 80 at r1 (raw file):
}; let parallelism = this.workers.parallelism().get();
Shouldn't this value be injected?
crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs
line 110 at r1 (raw file):
fn diagnostics_controller_tick(&self, mut state_snapshots: Vec<StateSnapshot>) { assert_eq!(state_snapshots.len(), self.workers.parallelism().get() + 1); let state = state_snapshots.pop().expect("we just asserted that it exists");
Not a useful message, if we get it (i know you get the location with the trace but still it's just weird)
crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs
line 129 at r1 (raw file):
self.spawn_worker(move |project_diagnostics, notifier| { clear_old_diagnostics(&state.db, files_to_preserve, project_diagnostics, notifier);
Just to make sure, there's a guarantee that the ones that were refreshed in this batch will publish too, when the diags are empty? (otherwise there's inconsistent state on the side of the client)
crates/cairo-lang-language-server/src/lang/diagnostics/project_diagnostics.rs
line 12 at r1 (raw file):
/// Takes the result of locking and on error logs it and returns the default result value. macro_rules! try_lock {
It implies that the macro itself does the locking which is a tad confusing
crates/cairo-lang-language-server/src/lang/diagnostics/refresh.rs
line 75 at r1 (raw file):
for mut file_diagnostics in removed { // It might be that we are removing a file that actually had some diagnostics. // For example, this might happen if a `mod` item is removed for a file with a syntax error.
I don't really understand this one sadly :|
crates/cairo-lang-language-server/src/lang/diagnostics/file_diagnostics.rs
line 31 at r1 (raw file):
/// ## Virtual files /// /// When collecting diagnostics using [`FileDiagnostics::collect`], all virtual files related
Shouldn't it be mentioned that it's also only visiting main module files?
93da297
to
331270d
Compare
77e2b06
to
b2b3f05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 6 files reviewed, 6 unresolved discussions (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)
crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs
line 80 at r1 (raw file):
Previously, Arcticae (Tomasz Rejowski) wrote…
Shouldn't this value be injected?
what do you mean by injected?
crates/cairo-lang-language-server/src/lang/diagnostics/mod.rs
line 110 at r1 (raw file):
Previously, Arcticae (Tomasz Rejowski) wrote…
Not a useful message, if we get it (i know you get the location with the trace but still it's just weird)
removed this message while refactoring. done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 6 files reviewed, 8 unresolved discussions (waiting on @Arcticae, @mkaput, @orizi, and @piotmag769)
crates/cairo-lang-language-server/src/server/schedule/thread/pool.rs
line 96 at r2 (raw file):
} Pool { _handles: handles, job_sender, parallelism: NonZero::new(threads).unwrap() }
Can this be constructed from _handles.len()
?
crates/cairo-lang-language-server/src/lang/diagnostics/file_diagnostics.rs
line 27 at r2 (raw file):
/// /// Diagnostics in this structure are stored as Arcs that directly come from Salsa caches. /// This means that equality comparisons of `FileDiagnostics` are efficient.
This is just not true. https://github.com/rust-lang/rust/blob/a4cedecc9ec76b46dcbb954750068c832cf2dd43/library/alloc/src/sync.rs#L3267-L3268. Arc
is calling T
implementation of PartialEq
so it does not matter if we use Arc
here or not.
Code quote:
/// Diagnostics in this structure are stored as Arcs that directly come from Salsa caches.
/// This means that equality comparisons of `FileDiagnostics` are efficient.
commit-id:2a95e833
b2b3f05
to
91e9c50
Compare
331270d
to
8e4c053
Compare
Stack:
DiagnosticsController
#6657