Skip to content

Commit 0051a77

Browse files
committed
fix plugins
1 parent dde77ce commit 0051a77

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ executable haskell-language-server
368368
, safe-exceptions
369369
, hls-graph
370370
, sqlite-simple
371+
, stm
371372
, temporary
372373
, transformers
373374
, unordered-containers

plugins/default/src/Ide/Plugin/Example.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module Ide.Plugin.Example
1414
descriptor
1515
) where
1616

17+
import Control.Concurrent.STM
1718
import Control.DeepSeq (NFData)
1819
import Control.Monad.IO.Class
1920
import Control.Monad.Trans.Maybe
@@ -126,8 +127,8 @@ codeLens ideState plId CodeLensParams{_textDocument=TextDocumentIdentifier uri}
126127
case uriToFilePath' uri of
127128
Just (toNormalizedFilePath -> filePath) -> do
128129
_ <- runIdeAction "Example.codeLens" (shakeExtras ideState) $ runMaybeT $ useE TypeCheck filePath
129-
_diag <- getDiagnostics ideState
130-
_hDiag <- getHiddenDiagnostics ideState
130+
_diag <- atomically $ getDiagnostics ideState
131+
_hDiag <- atomically $ getHiddenDiagnostics ideState
131132
let
132133
title = "Add TODO Item via Code Lens"
133134
-- tedit = [TextEdit (Range (Position 3 0) (Position 3 0))

plugins/default/src/Ide/Plugin/Example2.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module Ide.Plugin.Example2
1414
descriptor
1515
) where
1616

17+
import Control.Concurrent.STM
1718
import Control.DeepSeq (NFData)
1819
import Control.Monad.IO.Class
1920
import Control.Monad.Trans.Maybe
@@ -116,8 +117,8 @@ codeLens ideState plId CodeLensParams{_textDocument=TextDocumentIdentifier uri}
116117
case uriToFilePath' uri of
117118
Just (toNormalizedFilePath -> filePath) -> do
118119
_ <- runIdeAction (fromNormalizedFilePath filePath) (shakeExtras ideState) $ runMaybeT $ useE TypeCheck filePath
119-
_diag <- getDiagnostics ideState
120-
_hDiag <- getHiddenDiagnostics ideState
120+
_diag <- atomically $ getDiagnostics ideState
121+
_hDiag <- atomically $ getHiddenDiagnostics ideState
121122
let
122123
title = "Add TODO2 Item via Code Lens"
123124
range = Range (Position 3 0) (Position 4 0)

plugins/hls-hlint-plugin/hls-hlint-plugin.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ library
6363
, lens
6464
, lsp
6565
, regex-tdfa
66+
, stm
6667
, temporary
6768
, text
6869
, transformers

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module Ide.Plugin.Hlint
2626
--, provider
2727
) where
2828
import Control.Arrow ((&&&))
29+
import Control.Concurrent.STM
2930
import Control.DeepSeq
3031
import Control.Exception
3132
import Control.Lens ((^.))
@@ -308,7 +309,7 @@ codeActionProvider ideState plId (CodeActionParams _ _ docId _ context) = Right
308309
where
309310

310311
getCodeActions = do
311-
allDiags <- getDiagnostics ideState
312+
allDiags <- atomically $ getDiagnostics ideState
312313
let docNfp = toNormalizedFilePath' <$> uriToFilePath' (docId ^. LSP.uri)
313314
numHintsInDoc = length
314315
[d | (nfp, _, d) <- allDiags

0 commit comments

Comments
 (0)