-
-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch does two things: 1. It allows us to track the versions of `Values` which don't come from the VFS, as long as those particular `Values` depended on the `GetModificationTime` rule This is necessary for the recompilation avoidance scheme implemented in #2316 2. It removes the VFSHandle type and instead relies on snapshots of the VFS state taken on every rebuild of the shake session to ensure that we see a consistent VFS state throughout each individual build. With regards to 2, this is necessary because the lsp library mutates its VFS file store as changes come in. This can lead to scenarios where the HLS build session can see inconsistent views of the VFS. One such scenario is. 1. HLS build starts, with VFS state A 2. LSP Change request comes in and lsp updates its internal VFS state to B 3. HLS build continues, now consulting VFS state B 4. lsp calls the HLS file change handler, interrupting the build and restarting it. However, the build might have completed, or cached results computed using an inconsistent VFS state.
- Loading branch information
Showing
13 changed files
with
172 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{-# LANGUAGE CPP #-} | ||
|
||
module Development.IDE.Core.FileUtils( | ||
getModTime, | ||
) where | ||
|
||
|
||
import Data.Time.Clock.POSIX | ||
#ifdef mingw32_HOST_OS | ||
import qualified System.Directory as Dir | ||
#else | ||
import System.Posix.Files (getFileStatus, | ||
modificationTimeHiRes) | ||
#endif | ||
|
||
-- Dir.getModificationTime is surprisingly slow since it performs | ||
-- a ton of conversions. Since we do not actually care about | ||
-- the format of the time, we can get away with something cheaper. | ||
-- For now, we only try to do this on Unix systems where it seems to get the | ||
-- time spent checking file modifications (which happens on every change) | ||
-- from > 0.5s to ~0.15s. | ||
-- We might also want to try speeding this up on Windows at some point. | ||
-- TODO leverage DidChangeWatchedFile lsp notifications on clients that | ||
-- support them, as done for GetFileExists | ||
getModTime :: FilePath -> IO POSIXTime | ||
getModTime f = | ||
#ifdef mingw32_HOST_OS | ||
utcTimeToPOSIXSeconds <$> Dir.getModificationTime f | ||
#else | ||
modificationTimeHiRes <$> getFileStatus f | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.