Skip to content

Commit fc4ea30

Browse files
committed
Comment about the need to use tmp file
1 parent 95dde7c commit fc4ea30

File tree

1 file changed

+3
-0
lines changed
  • plugins/hls-hlint-plugin/src/Ide/Plugin

1 file changed

+3
-0
lines changed

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ applyHint ide nfp mhint =
326326
let fp = fromNormalizedFilePath nfp
327327
(_, mbOldContent) <- liftIO $ runAction "hlint" ide $ getFileContents nfp
328328
oldContent <- maybe (liftIO $ T.readFile fp) return mbOldContent
329+
-- We need to save a file with last edited contents cause `apply-refact`
330+
-- doesn't expose a function taking directly contents instead a file path.
331+
-- Ideally we should try to expose that function upstream and remove this.
329332
res <- liftIO $ withSystemTempFile (takeFileName fp) $ \temp h -> do
330333
hClose h
331334
writeFileUTF8NoNewLineTranslation temp oldContent

0 commit comments

Comments
 (0)