Revise.jl icon indicating copy to clipboard operation
Revise.jl copied to clipboard

Tools for when `FileWatching` doesn't work properly

Open staticfloat opened this issue 1 year ago • 1 comments

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?

staticfloat avatar Aug 09 '24 17:08 staticfloat

Does this not work https://timholy.github.io/Revise.jl/stable/config/#Polling-and-NFS-mounted-code-directories:-JULIA_REVISE_POLL ?

frankier avatar Aug 12 '24 09:08 frankier

I like the idea of revise(mod::Module; force::Bool = false)

danielalcalde avatar Sep 12 '24 07:09 danielalcalde

Doesn't that already exist too?

https://github.com/timholy/Revise.jl/blob/13a5eb7986ee1239ff938a92043c13fee04579cc/src/packagedef.jl#L851-L856

frankier avatar Sep 12 '24 08:09 frankier

It doesn’t actually work to just call revise(mod), that doesn’t force re-reading of the source on disk.

staticfloat avatar Sep 12 '24 15:09 staticfloat

yes, I'm not sure what revise(mod) does internally, but it does not work for me either.

danielalcalde avatar Sep 13 '24 09:09 danielalcalde

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.

timholy avatar Sep 24 '24 10:09 timholy