on master help sign in
Enable compatibility with the next version of HLint (#434)

* Use Just True == in preference to fromMaybe True or similar * Use trimStart instead of dropWhile isSpace * Whitespace only * Remove a redundant import * Enable HLint hints suggesting the extra library

commit53e6ea9aa930f8118e6f9b3d9981226be4cbdb20 authorNeil Mitchell <ndmitchell@gmail.com> dateMon 17 Feb 2020, 09:50 (7 years ago) parent00d914e
5 files changed+12−13
fmt.sh+1−1 src/Development/IDE/Plugin/CodeAction.hs+1−1 src/Development/IDE/Plugin/Completions/Logic.hs+4−4 src/Development/IDE/Spans/Common.hs+4−4 src/Development/IDE/Types/Options.hs+2−3
fmt.sh+1−1
@@ -1,3 +1,3 @@
11#!/usr/bin/env bash
22set -eou pipefail
3−curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s .
3+curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . --with-group=extra
src/Development/IDE/Plugin/CodeAction.hs+1−1
@@ -343,7 +343,7 @@ topOfHoleFitsMarker =
343343
344344mkRenameEdit :: Maybe T.Text -> Range -> T.Text -> TextEdit
345345mkRenameEdit contents range name =
346− if fromMaybe False maybeIsInfixFunction
346+ if maybeIsInfixFunction == Just True
347347 then TextEdit range ("`" <> name <> "`")
348348 else TextEdit range name
349349 where
src/Development/IDE/Plugin/Completions/Logic.hs+4−4
@@ -195,7 +195,7 @@ mkImportCompl enteredQual label =
195195 CompletionItem m (Just CiModule) (Just label)
196196 Nothing Nothing Nothing Nothing Nothing Nothing Nothing
197197 Nothing Nothing Nothing Nothing Nothing
198− where
198+ where
199199 m = fromMaybe "" (T.stripPrefix enteredQual label)
200200
201201mkExtCompl :: T.Text -> CompletionItem
@@ -303,7 +303,7 @@ toggleSnippets ClientCapabilities { _textDocument } (WithSnippets with) x
303303 | otherwise = x { _insertTextFormat = Just PlainText
304304 , _insertText = Nothing
305305 }
306− where supported = fromMaybe False (_textDocument >>= _completion >>= _completionItem >>= _snippetSupport)
306+ where supported = Just True == (_textDocument >>= _completion >>= _completionItem >>= _snippetSupport)
307307
308308-- | Returns the cached completions for the given module and position.
309309getCompletions :: IdeOptions -> CachedCompletions -> TypecheckedModule -> VFS.PosPrefixInfo -> ClientCapabilities -> WithSnippets -> IO [CompletionItem]
@@ -394,7 +394,7 @@ getCompletions ideOpts CC { allModNamesAsNS, unqualCompls, qualCompls, importabl
394394 = filtModNameCompls ++ map (toggleSnippets caps withSnippets
395395 . mkCompl ideOpts . stripAutoGenerated) filtCompls
396396 ++ filtKeywordCompls
397−
397+
398398 return result
399399
400400-- The supported languages and extensions
@@ -404,7 +404,7 @@ languagesAndExts = map T.pack $ DynFlags.supportedLanguagesAndExtensions ( Platf
404404#else
405405languagesAndExts = map T.pack DynFlags.supportedLanguagesAndExtensions
406406#endif
407−
407+
408408-- ---------------------------------------------------------------------
409409-- helper functions for pragmas
410410-- ---------------------------------------------------------------------
src/Development/IDE/Spans/Common.hs+4−4
@@ -18,6 +18,7 @@ module Development.IDE.Spans.Common (
1818import Data.Data
1919import qualified Data.Generics
2020import qualified Data.Text as T
21+import Data.List.Extra
2122
2223import GHC
2324import Outputable
@@ -28,7 +29,6 @@ import DataCon
2829import Var
2930#endif
3031
31−import Data.Char (isSpace)
3232import qualified Documentation.Haddock.Parser as H
3333import qualified Documentation.Haddock.Types as H
3434
@@ -135,9 +135,9 @@ haddockToMarkdown (H.DocHeader (H.Header level title))
135135 = replicate level '#' ++ " " ++ haddockToMarkdown title
136136
137137haddockToMarkdown (H.DocUnorderedList things)
138− = '\n' : (unlines $ map (("+ " ++) . dropWhile isSpace . splitForList . haddockToMarkdown) things)
138+ = '\n' : (unlines $ map (("+ " ++) . trimStart . splitForList . haddockToMarkdown) things)
139139haddockToMarkdown (H.DocOrderedList things)
140− = '\n' : (unlines $ map (("1. " ++) . dropWhile isSpace . splitForList . haddockToMarkdown) things)
140+ = '\n' : (unlines $ map (("1. " ++) . trimStart . splitForList . haddockToMarkdown) things)
141141haddockToMarkdown (H.DocDefList things)
142142 = '\n' : (unlines $ map (\(term, defn) -> "+ **" ++ haddockToMarkdown term ++ "**: " ++ haddockToMarkdown defn) things)
143143
@@ -159,4 +159,4 @@ splitForList :: String -> String
159159splitForList s
160160 = case lines s of
161161 [] -> ""
162− (first:rest) -> unlines $ first : map ((" " ++) . dropWhile isSpace) rest
162+ (first:rest) -> unlines $ first : map ((" " ++) . trimStart) rest
src/Development/IDE/Types/Options.hs+2−3
@@ -14,7 +14,6 @@ module Development.IDE.Types.Options
1414 , defaultIdeOptions
1515 ) where
1616
17−import Data.Maybe
1817import Development.Shake
1918import Development.IDE.GHC.Util
2019import GHC hiding (parseModule, typecheckModule)
@@ -68,8 +67,8 @@ newtype IdeReportProgress = IdeReportProgress Bool
6867newtype IdeDefer = IdeDefer Bool
6968
7069clientSupportsProgress :: LSP.ClientCapabilities -> IdeReportProgress
71−clientSupportsProgress caps = IdeReportProgress $ fromMaybe False $
72− LSP._workDoneProgress =<< LSP._window (caps :: LSP.ClientCapabilities)
70+clientSupportsProgress caps = IdeReportProgress $ Just True ==
71+ (LSP._workDoneProgress =<< LSP._window (caps :: LSP.ClientCapabilities))
7372
7473defaultIdeOptions :: Action (FilePath -> Action HscEnvEq) -> IdeOptions
7574defaultIdeOptions session = IdeOptions