Skip to content

Commit 24f9f9b

Browse files
committed
Re-use existing GetFileContents rule
1 parent 02a230d commit 24f9f9b

File tree

1 file changed

+4
-5
lines changed
  • plugins/hls-cabal-plugin/src/Ide/Plugin

1 file changed

+4
-5
lines changed

Diff for: plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs

+4-5
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import qualified Language.LSP.Types as LSP
4040
import qualified Language.LSP.VFS as VFS
4141

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

0 commit comments

Comments
 (0)