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 (#13)
  • Loading branch information
Draggu authored Dec 4, 2024
1 parent 06ae193 commit 4c7e9de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server/routing/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ 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 4c7e9de

Please sign in to comment.