Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/ruff_db/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ impl Files {
.root(db, path)
.map_or(Durability::default(), |root| root.durability(db));

let builder = File::builder(FilePath::System(absolute)).durability(durability);
let builder = File::builder(FilePath::System(absolute))
.durability(durability)
.path_durability(Durability::HIGH);

let builder = match metadata {
Ok(metadata) if metadata.file_type().is_file() => builder
Expand Down Expand Up @@ -159,9 +161,11 @@ impl Files {
tracing::trace!("Adding virtual file {}", path);
let virtual_file = VirtualFile(
File::builder(FilePath::SystemVirtual(path.to_path_buf()))
.path_durability(Durability::HIGH)
.status(FileStatus::Exists)
.revision(FileRevision::zero())
.permissions(None)
.permissions_durability(Durability::HIGH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if permissions on a file do change? Do we treat them as immutable and ignore such changes? Do we not even watch for permission changes? I assume permissions aren't part of the file identity...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Virtual files don't have a permission, it's always set to None

.new(db),
);
self.inner
Expand Down Expand Up @@ -272,7 +276,7 @@ impl std::panic::RefUnwindSafe for Files {}
/// A file that's either stored on the host system's file system or in the vendored file system.
#[salsa::input]
pub struct File {
/// The path of the file.
/// The path of the file (immutable).
#[return_ref]
pub path: FilePath,

Expand Down
Loading