mirror of
https://github.com/haskell/ghcide.git
synced 2024-09-11 05:36:09 +03:00
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
This commit is contained in:
parent
00d914efa7
commit
53e6ea9aa9
2
fmt.sh
2
fmt.sh
@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eou pipefail
|
||||
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s .
|
||||
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . --with-group=extra
|
||||
|
@ -343,7 +343,7 @@ topOfHoleFitsMarker =
|
||||
|
||||
mkRenameEdit :: Maybe T.Text -> Range -> T.Text -> TextEdit
|
||||
mkRenameEdit contents range name =
|
||||
if fromMaybe False maybeIsInfixFunction
|
||||
if maybeIsInfixFunction == Just True
|
||||
then TextEdit range ("`" <> name <> "`")
|
||||
else TextEdit range name
|
||||
where
|
||||
|
@ -195,7 +195,7 @@ mkImportCompl enteredQual label =
|
||||
CompletionItem m (Just CiModule) (Just label)
|
||||
Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
||||
Nothing Nothing Nothing Nothing Nothing
|
||||
where
|
||||
where
|
||||
m = fromMaybe "" (T.stripPrefix enteredQual label)
|
||||
|
||||
mkExtCompl :: T.Text -> CompletionItem
|
||||
@ -303,7 +303,7 @@ toggleSnippets ClientCapabilities { _textDocument } (WithSnippets with) x
|
||||
| otherwise = x { _insertTextFormat = Just PlainText
|
||||
, _insertText = Nothing
|
||||
}
|
||||
where supported = fromMaybe False (_textDocument >>= _completion >>= _completionItem >>= _snippetSupport)
|
||||
where supported = Just True == (_textDocument >>= _completion >>= _completionItem >>= _snippetSupport)
|
||||
|
||||
-- | Returns the cached completions for the given module and position.
|
||||
getCompletions :: IdeOptions -> CachedCompletions -> TypecheckedModule -> VFS.PosPrefixInfo -> ClientCapabilities -> WithSnippets -> IO [CompletionItem]
|
||||
@ -394,7 +394,7 @@ getCompletions ideOpts CC { allModNamesAsNS, unqualCompls, qualCompls, importabl
|
||||
= filtModNameCompls ++ map (toggleSnippets caps withSnippets
|
||||
. mkCompl ideOpts . stripAutoGenerated) filtCompls
|
||||
++ filtKeywordCompls
|
||||
|
||||
|
||||
return result
|
||||
|
||||
-- The supported languages and extensions
|
||||
@ -404,7 +404,7 @@ languagesAndExts = map T.pack $ DynFlags.supportedLanguagesAndExtensions ( Platf
|
||||
#else
|
||||
languagesAndExts = map T.pack DynFlags.supportedLanguagesAndExtensions
|
||||
#endif
|
||||
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- helper functions for pragmas
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -18,6 +18,7 @@ module Development.IDE.Spans.Common (
|
||||
import Data.Data
|
||||
import qualified Data.Generics
|
||||
import qualified Data.Text as T
|
||||
import Data.List.Extra
|
||||
|
||||
import GHC
|
||||
import Outputable
|
||||
@ -28,7 +29,6 @@ import DataCon
|
||||
import Var
|
||||
#endif
|
||||
|
||||
import Data.Char (isSpace)
|
||||
import qualified Documentation.Haddock.Parser as H
|
||||
import qualified Documentation.Haddock.Types as H
|
||||
|
||||
@ -135,9 +135,9 @@ haddockToMarkdown (H.DocHeader (H.Header level title))
|
||||
= replicate level '#' ++ " " ++ haddockToMarkdown title
|
||||
|
||||
haddockToMarkdown (H.DocUnorderedList things)
|
||||
= '\n' : (unlines $ map (("+ " ++) . dropWhile isSpace . splitForList . haddockToMarkdown) things)
|
||||
= '\n' : (unlines $ map (("+ " ++) . trimStart . splitForList . haddockToMarkdown) things)
|
||||
haddockToMarkdown (H.DocOrderedList things)
|
||||
= '\n' : (unlines $ map (("1. " ++) . dropWhile isSpace . splitForList . haddockToMarkdown) things)
|
||||
= '\n' : (unlines $ map (("1. " ++) . trimStart . splitForList . haddockToMarkdown) things)
|
||||
haddockToMarkdown (H.DocDefList things)
|
||||
= '\n' : (unlines $ map (\(term, defn) -> "+ **" ++ haddockToMarkdown term ++ "**: " ++ haddockToMarkdown defn) things)
|
||||
|
||||
@ -159,4 +159,4 @@ splitForList :: String -> String
|
||||
splitForList s
|
||||
= case lines s of
|
||||
[] -> ""
|
||||
(first:rest) -> unlines $ first : map ((" " ++) . dropWhile isSpace) rest
|
||||
(first:rest) -> unlines $ first : map ((" " ++) . trimStart) rest
|
||||
|
@ -14,7 +14,6 @@ module Development.IDE.Types.Options
|
||||
, defaultIdeOptions
|
||||
) where
|
||||
|
||||
import Data.Maybe
|
||||
import Development.Shake
|
||||
import Development.IDE.GHC.Util
|
||||
import GHC hiding (parseModule, typecheckModule)
|
||||
@ -68,8 +67,8 @@ newtype IdeReportProgress = IdeReportProgress Bool
|
||||
newtype IdeDefer = IdeDefer Bool
|
||||
|
||||
clientSupportsProgress :: LSP.ClientCapabilities -> IdeReportProgress
|
||||
clientSupportsProgress caps = IdeReportProgress $ fromMaybe False $
|
||||
LSP._workDoneProgress =<< LSP._window (caps :: LSP.ClientCapabilities)
|
||||
clientSupportsProgress caps = IdeReportProgress $ Just True ==
|
||||
(LSP._workDoneProgress =<< LSP._window (caps :: LSP.ClientCapabilities))
|
||||
|
||||
defaultIdeOptions :: Action (FilePath -> Action HscEnvEq) -> IdeOptions
|
||||
defaultIdeOptions session = IdeOptions
|
||||
|
Loading…
Reference in New Issue
Block a user