Skip to content

Don't show the redundant space #2788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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