@@ -25,7 +25,7 @@ import Data.Text (Text)
25
25
import Data.Unique (hashUnique , newUnique )
26
26
27
27
import Control.Monad (replicateM )
28
- import Control.Monad.Trans.Except ( except )
28
+ import Control.Monad.Trans.Class ( lift )
29
29
import Data.Aeson (ToJSON (toJSON ))
30
30
import Data.List (find , intersperse )
31
31
import qualified Data.Text as T
@@ -108,7 +108,6 @@ import Language.LSP.Protocol.Types (CodeAction (..),
108
108
type (|? ) (InL , InR ))
109
109
110
110
#if __GLASGOW_HASKELL__ < 910
111
- import Control.Monad.Trans.Class (lift )
112
111
import Development.IDE.GHC.Compat (HsExpansion (HsExpanded ))
113
112
#endif
114
113
@@ -203,9 +202,14 @@ inlayHintProvider _ state pId InlayHintParams {_textDocument = TextDocumentIdent
203
202
end <- fmap _end range
204
203
names' <- names
205
204
defnLocs' <- defnLocs
206
- let excludeDotDot (Location _ (Range _ pos )) = pos /= end
205
+ let excludeDotDot (Location _ (Range _ end' )) = end' /= end
207
206
-- find location from dotdot definitions that name equal to label name
208
- findLocation t = fmap fst . find (either (const False ) ((==) t) . snd ) . filter (excludeDotDot . fst )
207
+ findLocation name locations =
208
+ let -- filter locations not within dotdot range
209
+ filteredLocations = filter (excludeDotDot . fst ) locations
210
+ -- checks if 'a' is equal to 'Name' if the 'Either' is 'Right a', otherwise return 'False'
211
+ nameEq = either (const False ) ((==) name)
212
+ in fmap fst $ find (nameEq . snd ) filteredLocations
209
213
valueWithLoc = [ (T. pack $ printName name, findLocation name defnLocs') | name <- names' ]
210
214
-- use `, ` to separate labels with definition location
211
215
label = intersperse (mkInlayHintLabelPart (" , " , Nothing )) $ fmap mkInlayHintLabelPart valueWithLoc
0 commit comments