Skip to content

Commit

Permalink
Explain invalidate of priv_raw_file_content as it is not necessary …
Browse files Browse the repository at this point in the history
…in current form

Since starkware-libs/cairo#6799, we can use `cancel_all` as well.
We keep this code to make it clear what we aim to achieve here.

commit-id:f1173e60
  • Loading branch information
Draggu committed Dec 4, 2024
1 parent 4adecb4 commit c2324de
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/server/routing/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ impl SyncNotificationHandler for DidChangeWatchedFiles {
for change in &params.changes {
if is_cairo_file_path(&change.uri) {
let Some(file) = state.db.file_for_url(&change.uri) else { continue };
// Invalidating the `priv_raw_file_content` query to be
// recomputed, works similar to manually triggering a low-durability synthetic
// write (this is what
// [`crate::lang::db::AnalysisDatabase::cancel_all`] does) to refresh it.
//
// We opt for this approach instead of using [`crate::lang::db::AnalysisDatabase::cancel_all`]
// because it is more descriptive and precise in targeting what we aim to achieve here.
PrivRawFileContentQuery.in_db_mut(state.db.as_files_group_mut()).invalidate(&file);
}
}
Expand Down

0 comments on commit c2324de

Please sign in to comment.