@@ -19,7 +19,7 @@ module Development.IDE.Core.FileStore(
19
19
resetInterfaceStore ,
20
20
getModificationTimeImpl ,
21
21
addIdeGlobal ,
22
- getFileContentsRule ,
22
+ getFileContentsImpl
23
23
) where
24
24
25
25
import Control.Concurrent.Extra
@@ -71,6 +71,7 @@ import Language.LSP.Server hiding
71
71
import qualified Language.LSP.Server as LSP
72
72
import Language.LSP.Types (FileChangeType (FcChanged ),
73
73
FileEvent (FileEvent ),
74
+ NormalizedFilePath (NormalizedFilePath ),
74
75
toNormalizedFilePath ,
75
76
uriToFilePath )
76
77
import Language.LSP.VFS
@@ -209,16 +210,21 @@ internalTimeToUTCTime large small =
209
210
#endif
210
211
211
212
getFileContentsRule :: VFSHandle -> Rules ()
212
- getFileContentsRule vfs =
213
- define $ \ GetFileContents file -> do
214
- -- need to depend on modification time to introduce a dependency with Cutoff
215
- time <- use_ GetModificationTime file
216
- res <- liftIO $ ideTryIOException file $ do
217
- mbVirtual <- getVirtualFile vfs $ filePathToUri' file
218
- pure $ Rope. toText . _text <$> mbVirtual
219
- case res of
220
- Left err -> return ([err], Nothing )
221
- Right contents -> return ([] , Just (time, contents))
213
+ getFileContentsRule vfs = define $ \ GetFileContents file -> getFileContentsImpl vfs file
214
+
215
+ getFileContentsImpl
216
+ :: VFSHandle
217
+ -> NormalizedFilePath
218
+ -> Action ([FileDiagnostic ], Maybe (FileVersion , Maybe T. Text ))
219
+ getFileContentsImpl vfs file = do
220
+ -- need to depend on modification time to introduce a dependency with Cutoff
221
+ time <- use_ GetModificationTime file
222
+ res <- liftIO $ ideTryIOException file $ do
223
+ mbVirtual <- getVirtualFile vfs $ filePathToUri' file
224
+ pure $ Rope. toText . _text <$> mbVirtual
225
+ case res of
226
+ Left err -> return ([err], Nothing )
227
+ Right contents -> return ([] , Just (time, contents))
222
228
223
229
ideTryIOException :: NormalizedFilePath -> IO a -> IO (Either FileDiagnostic a )
224
230
ideTryIOException fp act =
0 commit comments