1- {-# LANGUAGE FlexibleInstances #-}
2- {-# LANGUAGE MultiParamTypeClasses #-}
3- {-# LANGUAGE DeriveAnyClass #-}
4- {-# LANGUAGE GADTs #-}
5- {-# LANGUAGE DeriveGeneric #-}
6- {-# LANGUAGE OverloadedStrings #-}
7- {-# LANGUAGE RecordWildCards #-}
8- {-# LANGUAGE ScopedTypeVariables #-}
1+ {-# LANGUAGE DeriveAnyClass #-}
92
103module Development.IDE.Plugin.HLS
114 (
@@ -77,7 +70,7 @@ asGhcIdePlugin mp =
7770rulesPlugins :: [(PluginId , Rules () )] -> Plugin Config
7871rulesPlugins rs = Plugin rules mempty
7972 where
80- rules = mconcat $ map snd rs
73+ rules = foldMap snd rs
8174
8275codeActionPlugins :: [(PluginId , CodeActionProvider IdeState )] -> Plugin Config
8376codeActionPlugins cas = Plugin codeActionRules (codeActionHandlers cas)
@@ -104,7 +97,7 @@ makeCodeAction cas lf ideState (CodeActionParams docId range context _) = do
10497 then provider lf ideState pid docId range context
10598 else return $ Right (List [] )
10699 r <- mapM makeAction cas
107- let actions = filter wasRequested . concat $ map unL $ rights r
100+ let actions = filter wasRequested . foldMap unL $ rights r
108101 res <- send caps actions
109102 return $ Right res
110103 where
@@ -320,7 +313,7 @@ makeHover hps lf ideState params
320313 -- work out range here?
321314 let hs = catMaybes (rights mhs)
322315 r = listToMaybe $ mapMaybe (^. range) hs
323- h = case mconcat (( map ( ^. contents) hs) :: [ HoverContents ]) of
316+ h = case foldMap ( ^. contents) hs of
324317 HoverContentsMS (List [] ) -> Nothing
325318 hh -> Just $ Hover hh r
326319 return $ Right h
@@ -347,8 +340,7 @@ makeSymbols sps lf ideState params
347340 = do
348341 let uri' = params ^. textDocument . uri
349342 (C. ClientCapabilities _ tdc _ _) = LSP. clientCapabilities lf
350- supportsHierarchy = fromMaybe False $ tdc >>= C. _documentSymbol
351- >>= C. _hierarchicalDocumentSymbolSupport
343+ supportsHierarchy = Just True == (tdc >>= C. _documentSymbol >>= C. _hierarchicalDocumentSymbolSupport)
352344 convertSymbols :: [DocumentSymbol ] -> DSResult
353345 convertSymbols symbs
354346 | supportsHierarchy = DSDocumentSymbols $ List symbs
@@ -400,7 +392,7 @@ renameWith providers lspFuncs state params = do
400392 -- TODO:AZ: we need to consider the right way to combine possible renamers
401393 results <- mapM makeAction providers
402394 case partitionEithers results of
403- (errors, [] ) -> return $ Left $ responseError $ T. pack $ show $ errors
395+ (errors, [] ) -> return $ Left $ responseError $ T. pack $ show errors
404396 (_, edits) -> return $ Right $ mconcat edits
405397
406398-- ---------------------------------------------------------------------
@@ -443,7 +435,7 @@ makeCompletions :: [(PluginId, CompletionProvider IdeState)]
443435makeCompletions sps lf ideState params@ (CompletionParams (TextDocumentIdentifier doc) pos _context _mt)
444436 = do
445437 mprefix <- getPrefixAtPos lf doc pos
446- _snippets <- WithSnippets <$> completionSnippetsOn <$> getClientConfig lf
438+ _snippets <- WithSnippets . completionSnippetsOn <$> getClientConfig lf
447439
448440 let
449441 combine :: [CompletionResponseResult ] -> CompletionResponseResult
@@ -474,7 +466,7 @@ makeCompletions sps lf ideState params@(CompletionParams (TextDocumentIdentifier
474466
475467getPrefixAtPos :: LSP. LspFuncs Config -> Uri -> Position -> IO (Maybe VFS. PosPrefixInfo )
476468getPrefixAtPos lf uri pos = do
477- mvf <- ( LSP. getVirtualFileFunc lf) (J. toNormalizedUri uri)
469+ mvf <- LSP. getVirtualFileFunc lf (J. toNormalizedUri uri)
478470 case mvf of
479471 Just vf -> VFS. getCompletionPrefix pos vf
480472 Nothing -> return Nothing
0 commit comments