@@ -26,7 +26,6 @@ import Data.List (find, intersperse)
2626import qualified Data.Map as Map
2727import Data.Maybe (fromMaybe , isJust ,
2828 mapMaybe , maybeToList )
29- import Data.Monoid (First (.. ), getFirst )
3029import Data.Text (Text )
3130import qualified Data.Text as T
3231import Data.Unique (hashUnique , newUnique )
@@ -82,7 +81,7 @@ import Development.IDE.GHC.Compat.Core (Extension (NamedFieldPuns
8281 mapConPatDetail , mapLoc ,
8382 pattern RealSrcSpan ,
8483 plusUFM_C , unitUFM )
85- import Development.IDE.GHC.CoreFile (occNamePrefixes )
84+ import Development.IDE.GHC.CoreFile (stripOccNamePrefix )
8685import Development.IDE.GHC.Util (getExtensions ,
8786 printOutputable )
8887import Development.IDE.Graph (RuleResult )
@@ -228,7 +227,7 @@ inlayHintDotdotProvider _ state pId InlayHintParams {_textDocument = TextDocumen
228227 -- checks if 'a' is equal to 'Name' if the 'Either' is 'Right a', otherwise return 'False'
229228 nameEq = either (const False ) ((==) name)
230229 in fmap fst $ find (nameEq . snd ) filteredLocations
231- valueWithLoc = [ (stripPrefix $ T. pack $ printName name, findLocation name defnLocs') | name <- names' ]
230+ valueWithLoc = [ (stripOccNamePrefix $ T. pack $ printName name, findLocation name defnLocs') | name <- names' ]
232231 -- use `, ` to separate labels with definition location
233232 label = intersperse (mkInlayHintLabelPart (" , " , Nothing )) $ fmap mkInlayHintLabelPart valueWithLoc
234233 pure $ InlayHint { _position = currentEnd -- at the end of dotdot
@@ -618,16 +617,5 @@ getRecPatterns conPat@(conPatDetails . unLoc -> Just (RecCon flds))
618617getRecPatterns _ = ([] , False )
619618
620619printFieldName :: Outputable a => a -> Text
621- printFieldName = stripPrefix . printOutputable
622-
623- {- When e.g. DuplicateRecordFields is enabled, compiler generates
624- names like "$sel:accessor:One" and "$sel:accessor:Two" to
625- disambiguate record selectors
626- https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields#Implementation
627- -}
628- -- See also:
629- -- https://github.com/haskell/haskell-language-server/blob/master/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs#L811
630- stripPrefix :: T. Text -> T. Text
631- stripPrefix name = T. takeWhile (/= ' :' ) $ fromMaybe name $
632- getFirst $ foldMap (First . (`T.stripPrefix` name))
633- occNamePrefixes
620+ printFieldName = stripOccNamePrefix . printOutputable
621+
0 commit comments