File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
ghcide/src/Development/IDE/Spans Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import Control.Monad.IO.Class
40
40
import Control.Monad.Trans.Class
41
41
import Control.Monad.Trans.Maybe
42
42
import Data.Coerce (coerce )
43
+ import Data.Set (Set )
43
44
import qualified Data.HashMap.Strict as HM
44
45
import qualified Data.Map.Strict as M
45
46
import Data.Maybe
@@ -152,9 +153,9 @@ typeRowToLoc (row:.info) = do
152
153
153
154
documentHighlight
154
155
:: 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
158
159
-> MaybeT m [DocumentHighlight ]
159
160
documentHighlight hf rf pos = pure highlights
160
161
where
@@ -163,8 +164,12 @@ documentHighlight hf rf pos = pure highlights
163
164
n <- ns
164
165
ref <- fromMaybe [] (M. lookup (Right n) rf)
165
166
pure $ makeHighlight ref
167
+
168
+ makeHighlight :: (RealSrcSpan , IdentifierDetails a ) -> DocumentHighlight
166
169
makeHighlight (sp,dets) =
167
170
DocumentHighlight (realSrcSpanToRange sp) (Just $ highlightType $ identInfo dets)
171
+
172
+ highlightType :: Set ContextInfo -> DocumentHighlightKind
168
173
highlightType s =
169
174
if any (isJust . getScopeFromContext) s
170
175
then HkWrite
You can’t perform that action at this time.
0 commit comments