Skip to content

Commit

Permalink
Add space after comma when exporting a name (#2547)
Browse files Browse the repository at this point in the history
* Add space after comma when exporting a name

* Fix tests
  • Loading branch information
sergv committed Dec 30, 2021
1 parent 7518a3a commit 65a8512
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/CodeAction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ suggestExportUnusedTopBinding srcOpt ParsedModule{pm_parsed_source = L _ HsModul
$ hsmodDecls
, Just pos <- fmap _end . getLocatedRange =<< hsmodExports
, Just needComma <- needsComma source <$> hsmodExports
, let exportName = (if needComma then "," else "") <> printExport exportType name
, let exportName = (if needComma then ", " else "") <> printExport exportType name
insertPos = pos {_character = pred $ _character pos}
= [("Export ‘" <> name <> "", TextEdit (Range insertPos insertPos) exportName)]
| otherwise = []
Expand Down
4 changes: 2 additions & 2 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3367,7 +3367,7 @@ exportUnusedTests = testGroup "export unused actions"
"Export ‘bar’"
(Just $ T.unlines
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
, "module A (foo,bar) where"
, "module A (foo, bar) where"
, "foo = id"
, "bar = foo"])
, testSession "multi line explicit exports" $ template
Expand All @@ -3384,7 +3384,7 @@ exportUnusedTests = testGroup "export unused actions"
[ "{-# OPTIONS_GHC -Wunused-top-binds #-}"
, "module A"
, " ("
, " foo,bar) where"
, " foo, bar) where"
, "foo = id"
, "bar = foo"])
, testSession "export list ends in comma" $ template
Expand Down

0 comments on commit 65a8512

Please sign in to comment.