classpath icon indicating copy to clipboard operation
classpath copied to clipboard

watch-deps doesn't react to changes

Open maxthoursie opened this issue 4 years ago • 5 comments

After running (watch-deps/start! {}) and then changing deps.edn, I don't see the printed message and the classpath-chain haven't changed. Some experimentation seems to indicate that beholder doesn't get any event.

This is on a Mac using Calva.

Manually running the code inside the on-event handler in watch-deps works as intended. It correctly loads the newly added lib in deps to the classspath.

As a side note, it would be great if the body of watch-deps was a separate public fn, so I easily can reload the deps.edn file on demand without running the watcher.

Thank you for tackling a problem that needs a solution!

maxthoursie avatar Sep 01 '21 08:09 maxthoursie

Maybe file an issue on Beholder?

As a side note, it would be great if the body of watch-deps was a separate public fn, so I easily can reload the deps.edn file on demand without running the watcher.

You're looking for lambdaisland.classpath/update-classpath!

plexus avatar Sep 01 '21 11:09 plexus

lambdaisland.classpath/update-classpath! is indeed the one, thank you. I was surprised that watch-deps didn't use it internally but I see now that it does some additional logging.

Will look into filing an issue to beholder.

maxthoursie avatar Sep 01 '21 11:09 maxthoursie

It turns out that Beholder did what it should, but I didn't see the messages in the Calva repl. I used tap> to debug instead to get around that.

My system reports the path as an absolut path, so the = "./deps.edn" test fails and the new dependencies are never installed. Using str/ends-with? instead solved the issue.

In addition, watching on "." triggers an update every second on ./.calva/output-window/output.calva-repl. Whether that actually matters or not I don't know, but I filtered it out by only looking for changes in the "./deps.edn" file.

I can submit a PR if you'd like.

maxthoursie avatar Sep 03 '21 15:09 maxthoursie

That would be great. My impression was that beholder could only watch directories, not individual files.

On Fri, Sep 3, 2021, 17:09 Max Thoursie @.***> wrote:

It turns out that Beholder did what it should, but I didn't see the messages in the Calva repl. I used tap> to debug instead to get around that.

My system reports the path as an absolut path, so the = "./deps.edn" test fails and the new dependencies are never installed. Using str/ends-with? instead solved the issue.

In addition, watching on "." triggers an update every second on ./.calva/output-window/output.calva-repl. Whether that actually matters or not I don't know, but I filtered it out by only looking for changes in the "./deps.edn" file.

I can submit a PR if you'd like.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lambdaisland/classpath/issues/3#issuecomment-912609765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH3VD6HTFA5HMULIHZ5DDUADQK7ANCNFSM5DF7GXQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

plexus avatar Sep 03 '21 18:09 plexus

Here's the tiny change: #4

I did not include the watching on deps.edn only, because I couldn't find any documentation on that watching files is supported (like you said) so I am worried it won't work everywhere even though it works for me.

maxthoursie avatar Sep 13 '21 09:09 maxthoursie

Watching single files doesn't work on Windows (and it may only work on macOS), so not trying to watch just a single file was the right decision for #4. There's also some discussion in #7 about how watching works.

As far as I can tell, #4 fixes this and #7 covers the case for just watching a single file. Feel free to re-open if you experience this issue (or open a new issue).

alysbrooks avatar Jul 08 '23 03:07 alysbrooks