[red-knot] Reload notebook on file change (#12361)

This commit is contained in:
Micha Reiser 2024-07-17 14:23:48 +02:00 committed by GitHub
parent 6e0cbe0f35
commit 79b535587b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 10 deletions

View file

@ -21,7 +21,7 @@ pub fn source_text(db: &dyn Db, file: File) -> SourceText {
PySourceType::try_from_extension(extension) == Some(PySourceType::Ipynb)
}) {
// TODO(micha): Proper error handling and emit a diagnostic. Tackle it together with `source_text`.
let notebook = db.system().read_to_notebook(path).unwrap_or_else(|error| {
let notebook = file.read_to_notebook(db).unwrap_or_else(|error| {
tracing::error!("Failed to load notebook: {error}");
Notebook::empty()
});