Skip to content

Commit 83c56e4

Browse files
committed
update KindMap to TyThingMap
1 parent 31b31a2 commit 83c56e4

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

ghcide/src/Development/IDE/Core/RuleTypes.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,14 @@ type instance RuleResult GetHieAst = HieAstResult
238238
-- | A IntervalMap telling us what is in scope at each point
239239
type instance RuleResult GetBindings = Bindings
240240

241-
data DocAndKindMap = DKMap {getDocMap :: !DocMap, getKindMap :: !KindMap}
242-
instance NFData DocAndKindMap where
241+
data DocAndTyThingMap = DKMap {getDocMap :: !DocMap, getTyThingMap :: !TyThingMap}
242+
instance NFData DocAndTyThingMap where
243243
rnf (DKMap a b) = rwhnf a `seq` rwhnf b
244244

245-
instance Show DocAndKindMap where
245+
instance Show DocAndTyThingMap where
246246
show = const "docmap"
247247

248-
type instance RuleResult GetDocMap = DocAndKindMap
248+
type instance RuleResult GetDocMap = DocAndTyThingMap
249249

250250
-- | A GHC session that we reuse.
251251
type instance RuleResult GhcSession = HscEnvEq

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ resolveCompletion ide _pid comp@CompletionItem{_detail,_documentation,_data_} ur
144144
#endif
145145
mdkm <- liftIO $ runIdeAction "CompletionResolve.GetDocMap" (shakeExtras ide) $ useWithStaleFast GetDocMap file
146146
let (dm,km) = case mdkm of
147-
Just (DKMap docMap kindMap, _) -> (docMap,kindMap)
148-
Nothing -> (mempty, mempty)
147+
Just (DKMap docMap tyThingMap, _) -> (docMap,tyThingMap)
148+
Nothing -> (mempty, mempty)
149149
doc <- case lookupNameEnv dm name of
150150
Just doc -> pure $ spanDocToMarkdown doc
151151
Nothing -> liftIO $ spanDocToMarkdown <$> getDocumentationTryGhc (hscEnv sess) name

ghcide/src/Development/IDE/Spans/AtPoint.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ gotoDefinition withHieDb getHieFile ideOpts imports srcSpans pos
209209
atPoint
210210
:: IdeOptions
211211
-> HieAstResult
212-
-> DocAndKindMap
212+
-> DocAndTyThingMap
213213
-> HscEnv
214214
-> Position
215215
-> IO (Maybe (Maybe Range, [T.Text]))

ghcide/src/Development/IDE/Spans/Common.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Development.IDE.Spans.Common (
1212
, spanDocToMarkdown
1313
, spanDocToMarkdownForTest
1414
, DocMap
15-
, KindMap
15+
, TyThingMap
1616
) where
1717

1818
import Control.DeepSeq
@@ -31,7 +31,7 @@ import qualified Documentation.Haddock.Parser as H
3131
import qualified Documentation.Haddock.Types as H
3232

3333
type DocMap = NameEnv SpanDoc
34-
type KindMap = NameEnv TyThing
34+
type TyThingMap = NameEnv TyThing
3535

3636
-- | Shows IEWrappedName, without any modifier, qualifier or unique identifier.
3737
#if MIN_VERSION_ghc(9,5,0)

ghcide/src/Development/IDE/Spans/Documentation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ mkDocMap
3939
:: HscEnv
4040
-> RefMap a
4141
-> TcGblEnv
42-
-> IO DocAndKindMap
42+
-> IO DocAndTyThingMap
4343
mkDocMap env rm this_mod =
4444
do
4545
#if MIN_VERSION_ghc(9,3,0)

plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Internal.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import Development.IDE.Core.PluginUtils (runActionE,
4242
useWithStaleE)
4343
import Development.IDE.Core.PositionMapping (idDelta, toCurrentRange)
4444
import Development.IDE.Core.Rules (toIdeResult)
45-
import Development.IDE.Core.RuleTypes (DocAndKindMap (..))
45+
import Development.IDE.Core.RuleTypes (DocAndTyThingMap (..))
4646
import Development.IDE.Core.Shake (addPersistentRule,
4747
getVirtualFile,
4848
useWithStale_)
@@ -99,7 +99,7 @@ getSemanticTokensRule :: Recorder (WithPriority SemanticLog) -> Rules ()
9999
getSemanticTokensRule recorder =
100100
define (cmapWithPrio LogShake recorder) $ \GetSemanticTokens nfp -> handleError recorder $ do
101101
(HAR {..}) <- lift $ use_ GetHieAst nfp
102-
(DKMap{getKindMap}, _) <- lift $ useWithStale_ GetDocMap nfp
102+
(DKMap{getTyThingMap}, _) <- lift $ useWithStale_ GetDocMap nfp
103103
(_, ast) <- handleMaybe LogNoAST $ listToMaybe $ Map.toList $ getAsts hieAst
104104
virtualFile <- handleMaybeM LogNoVF $ getVirtualFile nfp
105105
-- get current location from the old ones
@@ -108,7 +108,7 @@ getSemanticTokensRule recorder =
108108
let localSemanticMap = mkLocalNameSemanticFromAst names (hieKindFunMasksKind hieKind) refMap
109109
-- get imported name semantic map
110110
-- liftIO $ putStrLn $ unlines $ fmap showClearName $ nameSetElemsStable nameSet
111-
let importedNameSemanticMap = foldr (getTypeExclude localSemanticMap getKindMap) emptyNameEnv names
111+
let importedNameSemanticMap = foldr (getTypeExclude localSemanticMap getTyThingMap) emptyNameEnv names
112112
-- let importedNameSemanticMap = computeImportedNameSemanticMap $ nameSetElemsStable nameSet
113113
let sMap = plusNameEnv_C (<>) importedNameSemanticMap localSemanticMap
114114
let rangeTokenType = extractSemanticTokensFromNames sMap spanNamesMap
@@ -120,10 +120,10 @@ getSemanticTokensRule recorder =
120120
-> Name
121121
-> NameEnv HsSemanticTokenType
122122
-> NameEnv HsSemanticTokenType
123-
getTypeExclude localEnv kindMap n nameMap
123+
getTypeExclude localEnv tyThingMap n nameMap
124124
| n `elemNameEnv` localEnv = nameMap
125125
| otherwise =
126-
let tyThing = lookupNameEnv kindMap n in
126+
let tyThing = lookupNameEnv tyThingMap n in
127127
maybe nameMap (extendNameEnv nameMap n) (tyThing >>= tyThingSemantic)
128128

129129
-- | Persistent rule to ensure that semantic tokens doesn't block on startup

0 commit comments

Comments
 (0)