Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools for when FileWatching doesn't work properly #839

Closed
staticfloat opened this issue Aug 9, 2024 · 6 comments · Fixed by #847
Closed

Tools for when FileWatching doesn't work properly #839

staticfloat opened this issue Aug 9, 2024 · 6 comments · Fixed by #847

Comments

@staticfloat
Copy link

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?

@frankier
Copy link

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

@danielalcalde
Copy link

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

@frankier
Copy link

Doesn't that already exist too?

Revise.jl/src/packagedef.jl

Lines 851 to 856 in 13a5eb7

"""
revise(mod::Module)
Reevaluate every definition in `mod`, whether it was changed or not. This is useful
to propagate an updated macro definition, or to force recompiling generated functions.
"""

@staticfloat
Copy link
Author

staticfloat commented Sep 12, 2024

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

@danielalcalde
Copy link

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

@timholy
Copy link
Owner

timholy commented Sep 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants