Skip to content

Commit 1c9c1b1

Browse files
committed
Merge branch 'all-constructors-import' of https://github.com/July541/haskell-language-server into all-constructors-import
2 parents b651281 + 408dfa1 commit 1c9c1b1

File tree

5 files changed

+13
-15
lines changed

5 files changed

+13
-15
lines changed

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ mkNameCompItem doc thingParent origName provenance thingType isInfix docs !imp =
230230
insertText = case isInfix of
231231
Nothing -> case getArgText <$> thingType of
232232
Nothing -> label
233-
Just argText -> label <> " " <> argText
233+
Just argText -> if T.null argText then label else label <> " " <> argText
234234
Just LeftSide -> label <> "`"
235235

236236
Just Surrounded -> label

ghcide/src/Development/IDE/Types/Exports.hs

+5-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import qualified Data.HashMap.Strict as Map
2222
import Data.HashSet (HashSet)
2323
import qualified Data.HashSet as Set
2424
import Data.Hashable (Hashable)
25-
import Data.List (isSuffixOf)
25+
import Data.List (isSuffixOf, foldl')
2626
import Data.Text (Text, pack)
2727
import Development.IDE.GHC.Compat
2828
import Development.IDE.GHC.Orphans ()
@@ -32,8 +32,8 @@ import HieDb
3232

3333

3434
data ExportsMap = ExportsMap
35-
{ getExportsMap :: HashMap IdentifierText (HashSet IdentInfo)
36-
, getModuleExportsMap :: HashMap ModuleNameText (HashSet IdentInfo)
35+
{ getExportsMap :: !(HashMap IdentifierText (HashSet IdentInfo))
36+
, getModuleExportsMap :: !(HashMap ModuleNameText (HashSet IdentInfo))
3737
}
3838
deriving (Show)
3939

@@ -134,13 +134,11 @@ createExportsMapMg modGuts = do
134134
concatMap (fmap (second Set.fromList) . unpackAvail getModuleName) (mg_exports mi)
135135

136136
updateExportsMapMg :: [ModGuts] -> ExportsMap -> ExportsMap
137-
updateExportsMapMg modGuts old =
138-
old' <> new
137+
updateExportsMapMg modGuts old = old' <> new
139138
where
140139
new = createExportsMapMg modGuts
141140
old' = deleteAll old (Map.keys $ getModuleExportsMap new)
142-
deleteAll = foldr deleteEntriesForModule
143-
141+
deleteAll = foldl' (flip deleteEntriesForModule)
144142

145143
createExportsMapTc :: [TcGblEnv] -> ExportsMap
146144
createExportsMapTc modIface = do

ghcide/test/exe/Main.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4839,13 +4839,13 @@ nonLocalCompletionTests =
48394839
"constructor"
48404840
["{-# OPTIONS_GHC -Wall #-}", "module A where", "f = True"]
48414841
(Position 2 8)
4842-
[ ("True", CiConstructor, "True ", True, True, Nothing)
4842+
[ ("True", CiConstructor, "True", True, True, Nothing)
48434843
],
48444844
completionTest
48454845
"type"
48464846
["{-# OPTIONS_GHC -Wall #-}", "module A () where", "f :: Boo", "f = True"]
48474847
(Position 2 8)
4848-
[ ("Bool", CiStruct, "Bool ", True, True, Nothing)
4848+
[ ("Bool", CiStruct, "Bool", True, True, Nothing)
48494849
],
48504850
completionTest
48514851
"qualified"
@@ -5020,7 +5020,7 @@ otherCompletionTests = [
50205020
-- This should be sufficient to detect that we are in a
50215021
-- type context and only show the completion to the type.
50225022
(Position 3 11)
5023-
[("Integer", CiStruct, "Integer ", True, True, Nothing)],
5023+
[("Integer", CiStruct, "Integer", True, True, Nothing)],
50245024

50255025
testSession "duplicate record fields" $ do
50265026
void $

hls-graph/src/Development/IDE/Graph/Internal/Types.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ getDatabaseValues = atomically
120120
. databaseValues
121121

122122
data Status
123-
= Clean Result
123+
= Clean !Result
124124
| Dirty (Maybe Result)
125125
| Running {
126126
runningStep :: !Step,
127127
runningWait :: !(IO ()),
128-
runningResult :: Result,
128+
runningResult :: Result, -- LAZY
129129
runningPrev :: !(Maybe Result)
130130
}
131131

@@ -145,7 +145,7 @@ data Result = Result {
145145
resultVisited :: !Step, -- ^ the step when it was last looked up
146146
resultDeps :: !ResultDeps,
147147
resultExecution :: !Seconds, -- ^ How long it took, last time it ran
148-
resultData :: BS.ByteString
148+
resultData :: !BS.ByteString
149149
}
150150

151151
data ResultDeps = UnknownDeps | AlwaysRerunDeps ![Key] | ResultDeps ![Key]

test/functional/Completion.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ snippetTests = testGroup "snippets" [
163163
item <- getCompletionByLabel "Nothing" compls
164164
liftIO $ do
165165
item ^. insertTextFormat @?= Just Snippet
166-
item ^. insertText @?= Just "Nothing "
166+
item ^. insertText @?= Just "Nothing"
167167

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

0 commit comments

Comments
 (0)