@@ -26,7 +26,6 @@ import Data.List (find, intersperse)
26
26
import qualified Data.Map as Map
27
27
import Data.Maybe (fromMaybe , isJust ,
28
28
mapMaybe , maybeToList )
29
- import Data.Monoid (First (.. ), getFirst )
30
29
import Data.Text (Text )
31
30
import qualified Data.Text as T
32
31
import Data.Unique (hashUnique , newUnique )
@@ -82,7 +81,7 @@ import Development.IDE.GHC.Compat.Core (Extension (NamedFieldPuns
82
81
mapConPatDetail , mapLoc ,
83
82
pattern RealSrcSpan ,
84
83
plusUFM_C , unitUFM )
85
- import Development.IDE.GHC.CoreFile (occNamePrefixes )
84
+ import Development.IDE.GHC.CoreFile (stripOccNamePrefix )
86
85
import Development.IDE.GHC.Util (getExtensions ,
87
86
printOutputable )
88
87
import Development.IDE.Graph (RuleResult )
@@ -240,7 +239,7 @@ inlayHintDotdotProvider _ state pId InlayHintParams {_textDocument = TextDocumen
240
239
-- checks if 'a' is equal to 'Name' if the 'Either' is 'Right a', otherwise return 'False'
241
240
nameEq = either (const False ) ((==) name)
242
241
in fmap fst $ find (nameEq . snd ) filteredLocations
243
- valueWithLoc = [ (stripPrefix $ T. pack $ printName name, findLocation name defnLocs') | name <- names' ]
242
+ valueWithLoc = [ (stripOccNamePrefix $ T. pack $ printName name, findLocation name defnLocs') | name <- names' ]
244
243
-- use `, ` to separate labels with definition location
245
244
label = intersperse (mkInlayHintLabelPart (" , " , Nothing )) $ fmap mkInlayHintLabelPart valueWithLoc
246
245
pure $ InlayHint { _position = currentEnd -- at the end of dotdot
@@ -645,16 +644,5 @@ getRecPatterns conPat@(conPatDetails . unLoc -> Just (RecCon flds))
645
644
getRecPatterns _ = ([] , False )
646
645
647
646
printFieldName :: Outputable a => a -> Text
648
- printFieldName = stripPrefix . printOutputable
649
-
650
- {- When e.g. DuplicateRecordFields is enabled, compiler generates
651
- names like "$sel:accessor:One" and "$sel:accessor:Two" to
652
- disambiguate record selectors
653
- https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields#Implementation
654
- -}
655
- -- See also:
656
- -- https://github.com/haskell/haskell-language-server/blob/master/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs#L811
657
- stripPrefix :: T. Text -> T. Text
658
- stripPrefix name = T. takeWhile (/= ' :' ) $ fromMaybe name $
659
- getFirst $ foldMap (First . (`T.stripPrefix` name))
660
- occNamePrefixes
647
+ printFieldName = stripOccNamePrefix . printOutputable
648
+
0 commit comments