Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 315dc7a

Browse files
Use bracket_ for kick signal in runWithSignal and mask async exceptions in Hlint plugin
1 parent 9b952c8 commit 315dc7a

File tree

2 files changed

+12
-6
lines changed
  • ghcide/src/Development/IDE/Core
  • plugins/hls-hlint-plugin/src/Ide/Plugin

2 files changed

+12
-6
lines changed

‎ghcide/src/Development/IDE/Core/Shake.hs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ import System.FilePath hiding (makeRelative)
178178
import System.IO.Unsafe (unsafePerformIO)
179179
import System.Time.Extra
180180
import UnliftIO (MonadUnliftIO (withRunInIO))
181+
import qualified UnliftIO.Exception as UE
181182

182183

183184
data Log
@@ -1477,7 +1478,8 @@ kickSignal testing lspEnv files msg = when testing $ liftIO $ mRunLspT lspEnv $
14771478
-- | Add kick start/done signal to rule
14781479
runWithSignal :: (KnownSymbol s0, KnownSymbol s1, IdeRule k v) => Proxy s0 -> Proxy s1 -> [NormalizedFilePath] -> k -> Action ()
14791480
runWithSignal msgStart msgEnd files rule = do
1480-
ShakeExtras{ideTesting = Options.IdeTesting testing, lspEnv} <- getShakeExtras
1481-
kickSignal testing lspEnv files msgStart
1482-
void $ uses rule files
1483-
kickSignal testing lspEnv files msgEnd
1481+
ShakeExtras {ideTesting = Options.IdeTesting testing, lspEnv} <- getShakeExtras
1482+
UE.bracket_
1483+
(kickSignal testing lspEnv files msgStart)
1484+
(kickSignal testing lspEnv files msgEnd)
1485+
$ void $ uses rule files

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ import System.Environment (setEnv,
6666
import Development.IDE.GHC.Compat (DynFlags,
6767
extensionFlags,
6868
ms_hspp_opts,
69-
topDir)
69+
topDir,
70+
uninterruptibleMaskM_)
7071
import qualified Development.IDE.GHC.Compat.Util as EnumSet
7172

7273
#if MIN_GHC_API_VERSION(9,4,0)
@@ -205,7 +206,10 @@ rules recorder plugin = do
205206

206207
defineNoFile (cmapWithPrio LogShake recorder) $ \GetHlintSettings -> do
207208
(Config flags) <- getHlintConfig plugin
208-
liftIO $ argsSettings flags
209+
-- argsSettings might capture async exceptions and throw it everytime we call it.
210+
-- So we must mask async exceptions here as an workaround.
211+
-- See https://github.com/haskell/haskell-language-server/issues/4718
212+
liftIO $ uninterruptibleMask_ $ argsSettings flags
209213

210214
action $ do
211215
files <- Map.keys <$> getFilesOfInterestUntracked

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /