Skip to content

Commit

Permalink
Re-use existing GetFileContents rule
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Nov 19, 2022
1 parent 02a230d commit 24f9f9b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import qualified Language.LSP.Types as LSP
import qualified Language.LSP.VFS as VFS

data Log
= LogModificationTime NormalizedFilePath (Maybe FileVersion)
= LogModificationTime NormalizedFilePath FileVersion
| LogShake Shake.Log
| LogDocOpened Uri
| LogDocModified Uri
Expand Down Expand Up @@ -138,11 +138,10 @@ cabalRules recorder = do
define (cmapWithPrio LogShake recorder) $ \ParseCabal file -> do
-- whenever this key is marked as dirty (e.g., when a user writes stuff to it),
-- we rerun this rule because this rule *depends* on GetModificationTime.
t <- use GetModificationTime file
(t, mCabalSource) <- use_ GetFileContents file
log' Debug $ LogModificationTime file t
mVirtualFile <- Shake.getVirtualFile file
contents <- case mVirtualFile of
Just vfile -> pure $ Encoding.encodeUtf8 $ VFS.virtualFileText vfile
contents <- case mCabalSource of
Just sources -> pure $ Encoding.encodeUtf8 sources
Nothing -> do
liftIO $ BS.readFile $ fromNormalizedFilePath file

Expand Down

0 comments on commit 24f9f9b

Please sign in to comment.