Skip to content

Commit 34b86cb

Browse files
committed
address comments
1 parent c316c74 commit 34b86cb

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ and this project adheres to Semantic Versioning (https://semver.org/spec/v2.0.0.
1515
### Fixed
1616

1717
- Normalize net and component symbol source paths to `package://...`, so emitted schematic/netlist `symbol_path` values no longer leak absolute cache paths.
18-
- Fix LSP simulation diagnostics leaking components across unrelated files due to shared module tree state.
1918

2019
## [0.3.47] - 2026-02-27
2120

crates/pcb-zen/src/lsp/mod.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ pub struct LspEvalContext {
4040
open_files: Arc<RwLock<HashMap<PathBuf, String>>>,
4141
netlist_subscriptions: Arc<RwLock<HashMap<PathBuf, HashMap<String, JsonValue>>>>,
4242
suppress_netlist_updates: Arc<RwLock<HashSet<PathBuf>>>,
43-
/// Per-file cache of the last successful eval output, populated during
44-
/// `parse_file_with_contents` so that `viewer/getState` and
45-
/// `on_save_diagnostics` can reuse it without a redundant full evaluation.
46-
last_eval_outputs: Arc<RwLock<HashMap<PathBuf, pcb_zen_core::EvalOutput>>>,
4743
/// Per-file cache of the schematic computed right after evaluation, before
4844
/// the shared session module tree can be contaminated by other files.
4945
last_schematics: Arc<RwLock<HashMap<PathBuf, pcb_sch::Schematic>>>,
@@ -169,7 +165,6 @@ impl Default for LspEvalContext {
169165
open_files,
170166
netlist_subscriptions: Arc::new(RwLock::new(HashMap::new())),
171167
suppress_netlist_updates: Arc::new(RwLock::new(HashSet::new())),
172-
last_eval_outputs: Arc::new(RwLock::new(HashMap::new())),
173168
last_schematics: Arc::new(RwLock::new(HashMap::new())),
174169
custom_request_handler: None,
175170
}
@@ -287,16 +282,6 @@ impl LspEvalContext {
287282
self.suppress_netlist_updates.write().unwrap().remove(&key)
288283
}
289284

290-
fn set_last_eval_output(&self, path: &Path, output: pcb_zen_core::EvalOutput) {
291-
let key = self.normalize_path(path);
292-
self.last_eval_outputs.write().unwrap().insert(key, output);
293-
}
294-
295-
fn clear_last_eval_output(&self, path: &Path) {
296-
let key = self.normalize_path(path);
297-
self.last_eval_outputs.write().unwrap().remove(&key);
298-
}
299-
300285
fn set_last_schematic(&self, path: &Path, schematic: pcb_sch::Schematic) {
301286
let key = self.normalize_path(path);
302287
self.last_schematics.write().unwrap().insert(key, schematic);
@@ -570,7 +555,6 @@ impl LspContext for LspEvalContext {
570555
if let Ok(canon) = self.file_provider.canonicalize(path) {
571556
self.inner.clear_file_contents(&canon);
572557
}
573-
self.clear_last_eval_output(path);
574558
self.clear_last_schematic(path);
575559
self.maybe_invalidate_symbol_library(path);
576560
self.maybe_invalidate_resolution_cache(path);
@@ -732,10 +716,6 @@ impl LspContext for LspEvalContext {
732716
result.diagnostics.apply_passes(&passes);
733717

734718
if let Some(parsed) = result.output.as_ref() {
735-
// Cache the eval output so viewer/getState and
736-
// on_save_diagnostics can reuse it without a redundant
737-
// full evaluation.
738-
self.set_last_eval_output(path, parsed.eval_output.clone());
739719
// Cache the schematic now, while the session module tree
740720
// still reflects only this file's evaluation.
741721
if let Ok(sch) = parsed.eval_output.to_schematic() {
@@ -744,9 +724,6 @@ impl LspContext for LspEvalContext {
744724
self.clear_last_schematic(path);
745725
}
746726
} else {
747-
// Don't let save diagnostics/viewer state reuse stale
748-
// output when the current parse/eval failed.
749-
self.clear_last_eval_output(path);
750727
self.clear_last_schematic(path);
751728
}
752729

0 commit comments

Comments
 (0)