Skip to content

Commit e24f590

Browse files
committed
haskell#3017 WIP: Filter out equivalent suggestions
1 parent 12a8bd3 commit e24f590

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plugins/hls-class-plugin/src/Ide/Plugin/Class/CodeAction.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,16 @@ codeAction recorder state plId (CodeActionParams _ _ docId _ context) = pluginRe
114114
logWith recorder Info (LogImplementedMethods cls implemented)
115115
pure
116116
$ concatMap mkAction
117+
$ nubBy (\(_, x) (_,y) -> x == y)
117118
$ filter ((/=) mempty . snd)
118119
$ fmap (second (filter (\(bind, _) -> bind `notElem` implemented)))
119-
$ (<>) [foo range sigs]
120-
$ minDefToMethodGroups range sigs
121-
$ classMinimalDef cls
120+
$ mkSuggestions range sigs cls
122121
where
123122
range = diag ^. J.range
123+
mkSuggestions range sigs cls = minimalDef <> [allClassMethods]
124+
where
125+
minimalDef = minDefToMethodGroups range sigs $ classMinimalDef cls
126+
allClassMethods = foo range sigs
124127

125128
mkAction :: Suggestion -> [Command |? CodeAction]
126129
mkAction (name, methodGroup)

0 commit comments

Comments
 (0)