Skip to content

Commit

Permalink
Don't show the redundant space (haskell#2788)
Browse files Browse the repository at this point in the history
* Don't show the redundant space

* Fix tests
  • Loading branch information
July541 committed Mar 29, 2022
1 parent 209061f commit a3bebd5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Plugin/Completions/Logic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ mkNameCompItem doc thingParent origName provenance thingType isInfix docs !imp =
insertText = case isInfix of
Nothing -> case getArgText <$> thingType of
Nothing -> label
Just argText -> label <> " " <> argText
Just argText -> if T.null argText then label else label <> " " <> argText
Just LeftSide -> label <> "`"

Just Surrounded -> label
Expand Down
10 changes: 5 additions & 5 deletions ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4057,8 +4057,8 @@ findDefinitionAndHoverTests = let
, testGroup "hover" $ mapMaybe snd tests
, checkFileCompiles sourceFilePath $
expectDiagnostics
[ ( "GotoHover.hs", [(DsError, (62, 7), "Found hole: _")])
, ( "GotoHover.hs", [(DsError, (65, 8), "Found hole: _")])
[ ( "GotoHover.hs", [(DsError, (62, 7), "Found hole: _")])
, ( "GotoHover.hs", [(DsError, (65, 8), "Found hole: _")])
]
, testGroup "type-definition" typeDefinitionTests ]

Expand Down Expand Up @@ -4717,13 +4717,13 @@ nonLocalCompletionTests =
"constructor"
["{-# OPTIONS_GHC -Wall #-}", "module A where", "f = True"]
(Position 2 8)
[ ("True", CiConstructor, "True ", True, True, Nothing)
[ ("True", CiConstructor, "True", True, True, Nothing)
],
completionTest
"type"
["{-# OPTIONS_GHC -Wall #-}", "module A () where", "f :: Boo", "f = True"]
(Position 2 8)
[ ("Bool", CiStruct, "Bool ", True, True, Nothing)
[ ("Bool", CiStruct, "Bool", True, True, Nothing)
],
completionTest
"qualified"
Expand Down Expand Up @@ -4898,7 +4898,7 @@ otherCompletionTests = [
-- This should be sufficient to detect that we are in a
-- type context and only show the completion to the type.
(Position 3 11)
[("Integer", CiStruct, "Integer ", True, True, Nothing)],
[("Integer", CiStruct, "Integer", True, True, Nothing)],

testSession "duplicate record fields" $ do
void $
Expand Down
2 changes: 1 addition & 1 deletion test/functional/Completion.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ snippetTests = testGroup "snippets" [
item <- getCompletionByLabel "Nothing" compls
liftIO $ do
item ^. insertTextFormat @?= Just Snippet
item ^. insertText @?= Just "Nothing "
item ^. insertText @?= Just "Nothing"

, testCase "work for polymorphic types" $ runSession hlsCommand fullCaps "test/testdata/completion" $ do
doc <- openDoc "Completion.hs" "haskell"
Expand Down

0 comments on commit a3bebd5

Please sign in to comment.