[red-knot] Support untitled files in the server (#13044)

## Summary

This PR adds support for untitled files in the red knot server.

## Test Plan

https://github.com/user-attachments/assets/57fa5db6-e1ad-4694-ae5f-c47a21eaa82b
This commit is contained in:
Dhruv Manilawala 2024-08-23 12:47:35 +05:30 committed by GitHub
parent 551ed2706b
commit cfe25ab465
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 138 additions and 45 deletions

View file

@ -318,6 +318,9 @@ impl File {
}
FilePath::Vendored(vendored) => db.vendored().read_to_string(vendored),
FilePath::SystemVirtual(system_virtual) => {
// Add a dependency on the revision to ensure the operation gets re-executed when the file changes.
let _ = self.revision(db);
db.system().read_virtual_path_to_string(system_virtual)
}
}
@ -342,6 +345,9 @@ impl File {
"Reading a notebook from the vendored file system is not supported.",
))),
FilePath::SystemVirtual(system_virtual) => {
// Add a dependency on the revision to ensure the operation gets re-executed when the file changes.
let _ = self.revision(db);
db.system().read_virtual_path_to_notebook(system_virtual)
}
}