Invalidate diagnostics for all open files after a cross-file change. Called when a class signature changes in one file, because diagnostics in other open files (unknown member, unknown class, deprecated usage) may depend on the changed class. The edited file itself is excluded (it is already scheduled by the caller). Push mode:** Queues all open files for the background worker. Pull mode:** In
(&self, exclude_uri: &str)
| 923 | /// **Pull mode:** Invalidates cached full diagnostics and sends |
| 924 | /// `workspace/diagnostic/refresh` so the editor re-pulls. |
| 925 | pub(crate) fn schedule_diagnostics_for_open_files(&self, exclude_uri: &str) { |
| 926 | if !self.init_complete.load(Ordering::Acquire) { |
| 927 | return; |
| 928 | } |
| 929 | |
| 930 | let pull_mode = self.supports_pull_diagnostics.load(Ordering::Acquire); |
| 931 | |
| 932 | let uris: Vec<String> = self |
| 933 | .open_files |
| 934 | .read() |
| 935 | .keys() |
| 936 | .filter(|u| u.as_str() != exclude_uri) |
| 937 | .cloned() |
| 938 | .collect(); |
| 939 | if uris.is_empty() { |
| 940 | return; |
| 941 | } |
| 942 | |
| 943 | if pull_mode { |
| 944 | // Invalidate cached full diagnostics so the next pull |
| 945 | // triggers a fresh computation. Do NOT remove resultIds — |
| 946 | // see the comment in schedule_diagnostics for why. |
| 947 | let mut cache = self.diag_last_full.lock(); |
| 948 | for uri in &uris { |
| 949 | cache.remove(uri); |
| 950 | } |
| 951 | } |
| 952 | |
| 953 | // Both modes: queue all files for the debounced background worker. |
| 954 | // In push mode the worker pushes the full assembled set. |
| 955 | // In pull mode the worker pushes only fast diagnostics and |
| 956 | // caches the full set in `diag_last_full` for pull responses. |
| 957 | { |
| 958 | let mut pending = self.diag_pending_uris.lock(); |
| 959 | for uri in uris { |
| 960 | if !pending.contains(&uri) { |
| 961 | pending.push(uri); |
| 962 | } |
| 963 | } |
| 964 | } |
| 965 | self.diag_version.fetch_add(1, Ordering::Release); |
| 966 | self.diag_notify.notify_one(); |
| 967 | } |
| 968 | |
| 969 | /// Compute native diagnostics for a single file (pull-mode path). |
| 970 | /// |