@@ -28,7 +28,6 @@ data Env = Env
2828 , envResponseChan :: Chan Response
2929 , envResponseController :: ResponseController
3030 , envDevMode :: Bool
31- , envHighlightingInfos :: IORef [HighlightingInfo ]
3231 }
3332
3433createInitEnv :: Bool -> IO Env
@@ -39,7 +38,6 @@ createInitEnv devMode =
3938 <*> newChan
4039 <*> ResponseController. new
4140 <*> pure devMode
42- <*> newIORef []
4341
4442--------------------------------------------------------------------------------
4543
@@ -87,27 +85,4 @@ signalCommandFinish = do
8785
8886-- | Sends a Response to the client via "envResponseChan"
8987sendResponse :: (Monad m , MonadIO m ) => Env -> Response -> TCMT m ()
90- sendResponse env response = do
91- case response of
92- -- NOTE: highlighting-releated reponses are intercepted for later use of semantic highlighting
93- ResponseHighlightingInfoDirect (HighlightingInfos _ highlightingInfos) -> do
94- appendHighlightingInfos env highlightingInfos
95- ResponseHighlightingInfoIndirect {} -> return ()
96- ResponseClearHighlightingTokenBased {} -> removeHighlightingInfos env
97- ResponseClearHighlightingNotOnlyTokenBased {} -> removeHighlightingInfos env
98- -- other kinds of responses
99- _ -> liftIO $ writeChan (envResponseChan env) response
100-
101- -- | Get highlighting informations
102- getHighlightingInfos :: (Monad m , MonadIO m ) => ServerM m [HighlightingInfo ]
103- getHighlightingInfos = do
104- ref <- asks envHighlightingInfos
105- liftIO (readIORef ref)
106-
107- appendHighlightingInfos :: (Monad m , MonadIO m ) => Env -> [HighlightingInfo ] -> TCMT m ()
108- appendHighlightingInfos env highlightingInfos =
109- liftIO (modifyIORef' (envHighlightingInfos env) (<> highlightingInfos))
110-
111- removeHighlightingInfos :: (Monad m , MonadIO m ) => Env -> TCMT m ()
112- removeHighlightingInfos env =
113- liftIO (writeIORef (envHighlightingInfos env) [] )
88+ sendResponse env response = liftIO $ writeChan (envResponseChan env) response
0 commit comments