Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork413
Reload .cabal files when they are modified#4630
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
4bd3727 tob9250a5Compare| cfps'<- liftIO$ filterM (IO.doesFileExist. fromNormalizedFilePath) (concatMap targetLocations all_targets) | ||
| void$ shakeEnqueue extras$ mkDelayedAction"InitialLoad"Debug$ void$do | ||
| mmt<- usesGetModificationTime cfps' | ||
| mmt<- usesGetPhysicalModificationTime cfps' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't understand how ignoring version in the VFS help us here🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Because cabal only works with the physical file system. If the VFS changes, then cabal simply can't perform a reload, ascabal repl will still observe the same.cabal file. That's why we only want to invalidate the shake session, if the.cabal file on disk has been modified.
Further, let's have a look atgetModificationTimeImpl:
getModificationTimeImpl::Bool->NormalizedFilePath->Action (MaybeBS.ByteString, ([FileDiagnostic],MaybeFileVersion))getModificationTimeImpl missingFileDiags file=dolet file'= fromNormalizedFilePath filelet wrap time= (Just$LBS.toStrict$B.encode$toRational time, ([],Just$ModificationTime time)) mbVf<- getVirtualFile filecase mbVfofJust (virtualFileVersion-> ver)->do alwaysRerunpure (Just$LBS.toStrict$B.encode ver, ([],Just$VFSVersion ver))Nothing->do isWF<- use_AddWatchedFile fileif isWFthen-- the file is watched so we can rely on FileWatched notifications,-- but also need a dependency on IsFileOfInterest to reinstall-- alwaysRerun when the file becomes VFS void (use_IsFileOfInterest file)elseif isInterface filethen-- interface files are tracked specially using the closed world assumptionpure()else-- in all other cases we will need to freshly check the file system alwaysRerun...
First, we don't care about theisInterface file check. Then, if the file isn't open in the VFS, we will never rerun this rule, unless theIsFileOfInterest rule is marked dirty, which it never will for.cabal files.
In my understanding,isWF will beTrue for.cabal files.
soulomoonJun 13, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the explanation, much clear to me now.
soulomoon commentedJun 13, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Just some more interesting thoughts, do you think we can make GetModificationTime rule use GetPhysicalModificationTime rule in the end to remove some duplicated file time query? |
fendor commentedJun 13, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I am not sure, maybe. The whole file watcher architecture requires a thorough overhaul, it feels very brittle. |
soulomoon commentedJun 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Indeed, are you planning to do it in this PR or open a seperate one for it? |
fendor commentedJun 16, 2025
I am not sure 😅 Probably in a follow-up, maybe we should merge this as is and hope for the best. |
| unless (null new_deps||not checkProject)$do | ||
| cfps'<- liftIO$ filterM (IO.doesFileExist. fromNormalizedFilePath) (concatMap targetLocations all_targets) | ||
| void$ shakeEnqueue extras$ mkDelayedAction"InitialLoad"Debug$ void$do | ||
| mmt<- usesGetModificationTime cfps' |
soulomoonJun 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
If I am not mistaken,GetPhysicalModificationTime is for.cabal files?
andcfps' are mostly.hs file locations, and we are type checking those files here.
But I do not really know how we handle.cabal file in HLS and where we callGetModificationTime for.cabal files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good catch, this is wrong, it should beGetModificationTime
soulomoon left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, better if we have a some test to capture this change.
03ffe6f to7212959Comparefendor commentedAug 8, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Finally with a regression test! This was a pain to write and I think I discovered another bug. Should be good to merge now. EDIT: strictly speaking, I still need to add a test that the reload-logic works even when the |
7212959 to1782380Compared18697c intomasterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Partially addresses#4236
It doesn't work with
sessionLoadingmultipleComponentsbecausehie-biosdoesn't give us the correct cradle dependencies.A workaround is to declare the cradle dependencies in the
hie.yaml. We need to fix this in hie-bios proper, but it is no longer an HLS bug.