import Language.Haskell.LSP.Capture
import Language.Haskell.LSP.Messages
import Language.Haskell.LSP.Types
-import Language.Haskell.LSP.Types.Lens as LSP hiding (error)
+import Language.Haskell.LSP.Types.Lens as LSP
import Data.Aeson
import Data.Default
import Data.List
sendMessages remainingMsgs reqSema rspSema
- response msg@(ResponseMessage _ id _ _) = do
+ response msg@(ResponseMessage _ id _) = do
liftIO $ putStrLn $ "Waiting for request id " ++ show id ++ " from the server"
reqId <- liftIO $ takeMVar reqSema
if responseId reqId /= id
swapCommands pid (FromServer t (RspInitialize rsp):xs) = FromServer t (RspInitialize swapped):swapCommands pid xs
where swapped = case newCommands of
- Just cmds -> result . _Just . LSP.capabilities . executeCommandProvider . _Just . commands .~ cmds $ rsp
+ Just cmds -> result . _Right . LSP.capabilities . executeCommandProvider . _Just . commands .~ cmds $ rsp
Nothing -> rsp
- oldCommands = rsp ^? result . _Just . LSP.capabilities . executeCommandProvider . _Just . commands
+ oldCommands = rsp ^? result . _Right . LSP.capabilities . executeCommandProvider . _Just . commands
newCommands = fmap (fmap (swapPid pid)) oldCommands
swapCommands pid (x:xs) = x:swapCommands pid xs