Fix overlay bug: Salsa wasn't re-reading from buffers when files were opened

The core issue was that when a file was opened in the LSP, if it had already
been read from disk, Salsa would return cached content instead of reading
from the overlay system. This happened because opening a file didn't bump
its revision, so Salsa had no reason to invalidate its cache.

Key changes:
- Created Buffers abstraction to encapsulate shared buffer storage
- Fixed Session::open_document() to bump revision when file already exists
- Added comprehensive integration tests to verify overlay behavior
- Refactored WorkspaceFileSystem to use Buffers instead of raw DashMap

This ensures that overlays always take precedence over disk content, fixing
the issue where LSP edits weren't being reflected in template parsing.
This commit is contained in:
Josh Thomas 2025-08-29 07:55:37 -05:00
parent 21403df0ba
commit 2dd779bcda
9 changed files with 650 additions and 89 deletions

View file

@ -1,9 +1,11 @@
mod buffers;
pub mod db;
mod document;
mod fs;
mod language;
mod template;
pub use buffers::Buffers;
pub use db::Database;
pub use document::TextDocument;
pub use fs::{FileSystem, OsFileSystem, WorkspaceFileSystem};