Skip to content

Editing project source

A notebook that lives inside a package spends most of its time calling that package's functions. When you change one, Slate notices, reloads the code into the running worker, and marks the cells that looked like they depended on it. You decide when to run them.

Nothing runs on its own. The result of a source edit is a banner and a set of stale cells.

What you see

A banner appears at the top left:

🔁 Project source changed — ~4 cells likely affected (our guess may be incomplete).

with Run affected, Re-run all (safe) and a dismiss button. It stays until you act on it.

When Slate cannot work out which cells are involved it says so and leads with Re-run all (safe) instead. If your edit does not compile you get a red banner naming the error, with no buttons, and tracking resumes as soon as the file parses again.

Ignoring the banner is fine. The affected cells are already stale, so the ordinary Run-stale path picks them up whenever you get to it.

What counts as a change

Slate parses each tracked file and hashes every top-level definition in it: functions, structs, abstract and primitive types, macros, and consts. A definition counts as changed when it is added, removed, or its body hashes differently. Moving code around a file without changing it is not a change.

If a package's __init__ is among them, Slate re-runs it for that package. Revise does not do that on its own.

How cells get chosen

The changed names are matched against what each cell reads, including dotted paths, so an edit to greet reaches a cell reading MyPkg.Sub.greet. Everything downstream of a match goes stale too.

There is also a deliberately coarse rule: if a changed name is one a cell provides, every name that cell provides joins the set. In practice the cell in question is your using MyPkg cell, so one changed export marks every cell that uses the package. Those cells would recompute on a re-run anyway, because any source edit changes the project's source digest.

There is no call-graph analysis. The matching is by name against the notebook's existing dependency graph.

What it will miss

Cases that produce no banner:

  • Definitions generated by a macro or a loop. @enum, or @eval inside a for, produce names the parser never sees. Base.@kwdef is fine.

  • A cell that reaches the code indirectly, through a function that calls the edited one. It is caught only by the package-wide rule above, which needs the using cell to have run successfully at least once.

  • locked cells, which are never restaled by anything. See Cell Tags.

  • Files Revise does not track, such as a .jl a cell includes directly rather than one that is part of a package module.

And the limits that are Revise's rather than Slate's: reassigning a const, or changing a struct whose instances already exist, needs a worker restart. Slate does not work around those.

Caching

A source edit changes the cache key of every cell, so nothing computed under the old code is restored. The old entries are not deleted, they simply stop matching, and re-storing is cheap because the data blobs are shared.

This happens in the worker and is not affected by the toggle below. Turning hot-reload off stops the banner and the automatic staling; it does not make Slate serve results from code you have changed.

The digest covers the enclosing project's src/ and the src/ of any path dependency the environment develops. A tracked package outside those directories can produce a banner without changing any cache key.

Turning it off

☰ → ⚙ Settings → This notebook → Execution → Hot-reload /src edits. It takes effect immediately, and persists in the notebook's config footer.

There is nothing to set up otherwise. It is on whenever the notebook runs on a worker (not an in-process kernel) and sits inside a project. The Files panel is the intended way to edit that source without leaving the browser, but an external editor works identically.

Remote workers and regions

Hot-reload works over a remote worker. Slate watches the local project's src/, and the src/ of each developed path dependency, and rsyncs changes to the remote as you save.

Revise has to be in your own global environment

Slate installs Revise into a remote worker only if you have it in your own global v1.x environment, on the principle of mirroring your setup rather than imposing one. If you do not use Revise locally, a remote worker or a region gets no hot-reload, and nothing says so.

Files outside src/ are not carried by that sync. See Project Files.

See also