Tools for when `FileWatching` doesn't work properly
I do a fair amount of development work on my MacBook Pro with a linux VM that has a shared folder setup so that my native VSCode edits files on my macOS partition, but the Linux guest VM can execute the code. While this works great overall, Revise doesn't work at all because the networked filesystem doesn't propagate file change notifications to FileWatching properly.
To work around this, I ended up cooking up the following recipe:
function rerevise(mod::Module)
pkgdata = Revise.pkgdatas[Revise.PkgId(mod)]
for file in pkgdata.info.files
push!(Revise.revision_queue, (pkgdata, file))
end
Revise.revise()
end
Perhaps we can have a revise(mod::Module; force::Bool = false) method that does something similar to this, forcing re-evaluation of everything, regardless of what FileWatching says?
Does this not work https://timholy.github.io/Revise.jl/stable/config/#Polling-and-NFS-mounted-code-directories:-JULIA_REVISE_POLL ?
I like the idea of revise(mod::Module; force::Bool = false)
Doesn't that already exist too?
https://github.com/timholy/Revise.jl/blob/13a5eb7986ee1239ff938a92043c13fee04579cc/src/packagedef.jl#L851-L856
It doesn’t actually work to just call revise(mod), that doesn’t force re-reading of the source on disk.
yes, I'm not sure what revise(mod) does internally, but it does not work for me either.
It doesn’t actually work to just call revise(mod), that doesn’t force re-reading of the source on disk.
Good point, we can fix that.
yes, I'm not sure what revise(mod) does internally
It re-evaluates everything regardless of whether it has changed. This is the "nuclear option" as it can cause an enormous amount of invalidation and recompilation.
The existing revise(mod::Module) should probably have been named reeval(mod::Module). But I think we can add this behavior via revise(mod; force=false). xref #847.