thanks, this is helpful, let’s say we are in the package scenario, is there a way to know if Revise is tracking that package and not just if it was loaded (but maybe it is tracking something else)?
The following can check if the module runs “under Revise” - except I don’t know if it would work under FreeBSD and the like.
module Inrev
const revise_uuid = Base.UUID("295af30f-e4ad-537b-8983-00126c2a3abe")
const revise_pkgid = Base.PkgId(revise_uuid, "Revise")
function checkrev()
revise_pkgid in keys(Base.loaded_modules) || return false
d = @__DIR__
f = splitpath(@__FILE__)[end]
watched_files = getproperty(Main.Revise, :watched_files)
d in keys(watched_files) || return false
trackedfiles = watched_files[d].trackedfiles
return f in keys(trackedfiles)
end
macro inrev(args...)
println(checkrev())
end
export @inrev
end