pull responder out of case

This commit is contained in:
Patrick Aldis 2026-03-09 16:15:33 +00:00
parent 535d985aa9
commit 6b2ae759ab

View File

@ -17,19 +17,18 @@ tokenHandler :: Handlers DLogLspM
tokenHandler = requestHandler SMethod_TextDocumentSemanticTokensFull $ \req responder -> do tokenHandler = requestHandler SMethod_TextDocumentSemanticTokensFull $ \req responder -> do
LSPState parseRef <- getConfig LSPState parseRef <- getConfig
p <- lift . readTVarIO $ parseRef p <- lift . readTVarIO $ parseRef
case M.lookup (currentBufferUri req) p of responder $
Nothing -> case M.lookup (currentBufferUri req) p of
responder (Left $ TResponseError (InL LSPErrorCodes_RequestFailed) "Doc not bundle" Nothing) Nothing ->
Just (Left _) -> Left $ TResponseError (InL LSPErrorCodes_RequestFailed) "Doc not bundle" Nothing
responder (Left $ TResponseError (InL LSPErrorCodes_RequestFailed) "Failed to parse" Nothing) Just (Left _) ->
Just (Right prog) -> do Left $ TResponseError (InL LSPErrorCodes_RequestFailed) "Failed to parse" Nothing
responder Just (Right prog) ->
( Right Right
. InL . InL
. fromRight (SemanticTokens Nothing []) . fromRight (SemanticTokens Nothing [])
. makeSemanticTokens defaultSemanticTokensLegend . makeSemanticTokens defaultSemanticTokensLegend
$ highlightProg prog $ highlightProg prog
)
highlightProg :: Program' SrcLoc -> [SemanticTokenAbsolute] highlightProg :: Program' SrcLoc -> [SemanticTokenAbsolute]
highlightProg (Program _ rs) = rs >>= highlightRule highlightProg (Program _ rs) = rs >>= highlightRule