Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 8e24b12

Browse files
committed
Add spaces to the correct positions
1 parent bcac2b5 commit 8e24b12

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/Haskell/Ide/Engine/Plugin/HsImport.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,15 @@ codeActionProvider plId docId _ context = do
437437
title = "Import module "
438438
<> modName
439439
<> case termType importDiagnostic of
440-
Hiding _ -> "hiding "
440+
Hiding _ -> "hiding"
441441
-- ^ Note, that it must never happen
442442
-- in combination with `symbolType == Nothing`
443-
Import _ -> " "
443+
Import _ -> ""
444444
<> case symbolType of
445445
Just s -> case s of
446-
Only sym -> "(" <> sym <> ")"
447-
AllOf dt -> "(" <> dt <> " (..))"
448-
OneOf dt sym -> "(" <> dt <> " (" <> sym <> "))"
446+
Only sym -> " (" <> sym <> ")"
447+
AllOf dt -> " (" <> dt <> " (..))"
448+
OneOf dt sym -> " (" <> dt <> " (" <> sym <> "))"
449449
Nothing -> ""
450450

451451
importStyleParam :: ImportStyle

test/functional/FunctionalCodeActionsSpec.hs

+14-14
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ spec = describe "code actions" $ do
157157
[ "{-# LANGUAGE NoImplicitPrelude #-}"
158158
, "import System.IO ( IO"
159159
, " , hPutStrLn"
160-
, " , stdout"
160+
, " , stderr"
161161
, " )"
162162
, "import Prelude ( Bool(..) )"
163163
, "import Control.Monad ( when )"
@@ -169,7 +169,7 @@ spec = describe "code actions" $ do
169169
, "main :: IO ()"
170170
, "main ="
171171
, " when True"
172-
, " $ hPutStrLn stdout"
172+
, " $ hPutStrLn stderr"
173173
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
174174
]
175175
]
@@ -199,7 +199,7 @@ spec = describe "code actions" $ do
199199
]
200200
, -- Complex imports for Constructos and functions
201201
[ "{-# LANGUAGE NoImplicitPrelude #-}"
202-
, "import System.IO (IO, hPutStrLn, stdout)"
202+
, "import System.IO (IO, hPutStrLn, stderr)"
203203
, "import Prelude (Bool(..))"
204204
, "import Control.Monad (when)"
205205
, "import Data.Maybe (fromMaybe, Maybe(Just))"
@@ -208,7 +208,7 @@ spec = describe "code actions" $ do
208208
, "main :: IO ()"
209209
, "main ="
210210
, " when True"
211-
, " $ hPutStrLn stdout"
211+
, " $ hPutStrLn stderr"
212212
, " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
213213
]
214214
]
@@ -685,13 +685,13 @@ hsImportSpec formatterName [e1, e2, e3, e4] =
685685
let config = def { formatOnImportOn = False, formattingProvider = formatterName }
686686
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (toJSON config))
687687

688-
let wantedCodeActionTitles = [ "Import module System.IO (hPutSetrLn)"
689-
, "Import module System.IO (stdout)"
688+
let wantedCodeActionTitles = [ "Import module System.IO (hPutStrLn)"
690689
, "Import module Control.Monad (when)"
691690
, "Import module Data.Maybe (fromMaybe)"
692691
, "Import module Data.Function (($))"
693-
, "Import module Data.Maybe (Maybe(Just))"
694-
, "Import module Prelude (Bool(..))"
692+
, "Import module Data.Maybe (Maybe (Just))"
693+
, "Import module Prelude (Bool (..))"
694+
, "Import module System.IO (stderr)"
695695
]
696696

697697
executeAllCodeActions doc wantedCodeActionTitles
@@ -708,12 +708,12 @@ hsImportSpec formatterName [e1, e2, e3, e4] =
708708
sendNotification WorkspaceDidChangeConfiguration (DidChangeConfigurationParams (toJSON config))
709709

710710
let wantedCodeActionTitles = [ "Import module System.IO (hPutStrLn)"
711-
, "Import module System.IO (stdout)"
712711
, "Import module Control.Monad (when)"
713712
, "Import module Data.Maybe (fromMaybe)"
714713
, "Import module Data.Function (($))"
715-
, "Import module Data.Maybe (Maybe(Just))"
716-
, "Import module Prelude (Bool(..))"
714+
, "Import module Data.Maybe (Maybe (Just))"
715+
, "Import module Prelude (Bool (..))"
716+
, "Import module System.IO (stderr)"
717717
]
718718

719719
executeAllCodeActions doc wantedCodeActionTitles
@@ -722,7 +722,7 @@ hsImportSpec formatterName [e1, e2, e3, e4] =
722722
liftIO $ do
723723
let [l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12] = T.lines contents
724724
l1 `shouldBe` "{-# LANGUAGE NoImplicitPrelude #-}"
725-
l2 `shouldBe` "import System.IO (IO, hPutStrLn, stdout)"
725+
l2 `shouldBe` "import System.IO (IO, hPutStrLn, stderr)"
726726
l3 `shouldBe` "import Prelude (Bool(..))"
727727
l4 `shouldBe` "import Control.Monad (when)"
728728
l5 `shouldBe` "import Data.Maybe (fromMaybe, Maybe(Just))"
@@ -731,7 +731,7 @@ hsImportSpec formatterName [e1, e2, e3, e4] =
731731
l8 `shouldBe` "main :: IO ()"
732732
l9 `shouldBe` "main ="
733733
l10 `shouldBe` " when True"
734-
l11 `shouldBe` " $ hPutStrLn stdout"
734+
l11 `shouldBe` " $ hPutStrLn stderr"
735735
l12 `shouldBe` " $ fromMaybe \"Good night, World!\" (Just \"Hello, World!\")"
736736

737737
where
@@ -754,7 +754,7 @@ hsImportSpec formatterName [e1, e2, e3, e4] =
754754
error
755755
$ "Found an unexpected amount of action. Expected 1, but got: "
756756
++ show (length xs)
757-
++ "\n. Titles: " ++ show (map (^. L.title) allActions)
757+
++ ".\n Titles: " ++ show (map (^. L.title) allActions)
758758

759759
-- Silence warnings
760760
hsImportSpec formatter args =

test/testdata/CodeActionImportListElaborate.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ import System.IO (IO)
44
main :: IO ()
55
main =
66
when True
7-
$ hPutStrLn stdout
7+
$ hPutStrLn stderr
88
$ fromMaybe "Good night, World!" (Just "Hello, World!")

0 commit comments

Comments
 (0)