Skip to content

Commit 64ab8e2

Browse files
committed
Development.IDE.Spans.AtPoint: documentHighligh: m upd
1 parent 9a13c7d commit 64ab8e2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import Control.Monad.IO.Class
4040
import Control.Monad.Trans.Class
4141
import Control.Monad.Trans.Maybe
4242
import Data.Coerce (coerce)
43+
import Data.Set (Set)
4344
import qualified Data.HashMap.Strict as HM
4445
import qualified Data.Map.Strict as M
4546
import Data.Maybe
@@ -152,9 +153,9 @@ typeRowToLoc (row:.info) = do
152153

153154
documentHighlight
154155
:: Monad m
155-
=> HieASTs a
156-
-> RefMap a
157-
-> Position
156+
=> HieASTs a -- ^ get AST
157+
-> RefMap a -- ^ get map of identifiers to spans
158+
-> Position -- ^ get position
158159
-> MaybeT m [DocumentHighlight]
159160
documentHighlight hf rf pos = pure highlights
160161
where
@@ -163,8 +164,12 @@ documentHighlight hf rf pos = pure highlights
163164
n <- ns
164165
ref <- fromMaybe [] (M.lookup (Right n) rf)
165166
pure $ makeHighlight ref
167+
168+
makeHighlight :: (RealSrcSpan, IdentifierDetails a) -> DocumentHighlight
166169
makeHighlight (sp,dets) =
167170
DocumentHighlight (realSrcSpanToRange sp) (Just $ highlightType $ identInfo dets)
171+
172+
highlightType :: Set ContextInfo -> DocumentHighlightKind
168173
highlightType s =
169174
if any (isJust . getScopeFromContext) s
170175
then HkWrite

0 commit comments

Comments
 (0)