File tree 4 files changed +5
-14
lines changed
plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens
4 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ semanticTokensFull state _ param = do
94
94
-- Visible names from 'tmrRenamed'
95
95
--
96
96
-- It then combines this information to compute the semantic tokens for the file.
97
- getSemanticTokensRule :: Recorder (WithPriority SemanticLog ) -> Rules ()
97
+ getSemanticTokensRule :: Recorder (WithPriority SemanticLog ) -> Rules ()
98
98
getSemanticTokensRule recorder =
99
99
define (cmapWithPrio LogShake recorder) $ \ GetSemanticTokens nfp -> handleError recorder $ do
100
100
(HAR {.. }) <- lift $ use_ GetHieAst nfp
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import qualified Data.Set as Set
20
20
import Data.Text (Text , unpack )
21
21
import Development.IDE (HieKind (HieFresh , HieFromDisk ))
22
22
import Development.IDE.GHC.Compat
23
- import Ide.Plugin.SemanticTokens.Types hiding ( tokens )
23
+ import Ide.Plugin.SemanticTokens.Types
24
24
import Ide.Plugin.SemanticTokens.Utils (mkRange , recoverFunMaskArray )
25
25
import Language.LSP.Protocol.Types (LspEnum (knownValues ),
26
26
SemanticTokenAbsolute (SemanticTokenAbsolute ),
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ import Data.Text (Text)
19
19
import Development.IDE.Core.PositionMapping (PositionMapping ,
20
20
toCurrentRange )
21
21
import Development.IDE.GHC.Compat
22
+ import Development.IDE.GHC.Error (realSrcSpanToCodePointRange )
22
23
import Ide.Plugin.SemanticTokens.Mappings
23
24
import Ide.Plugin.SemanticTokens.Types (HieFunMaskKind ,
24
25
HsSemanticTokenType ,
25
26
NameSemanticMap )
26
- import Ide.Plugin.SemanticTokens.Utils (realSrcSpanToCodePointRange )
27
27
import Language.LSP.Protocol.Types
28
28
import Language.LSP.VFS (VirtualFile ,
29
29
codePointRangeToRange )
@@ -50,6 +50,8 @@ nameNameSemanticFromHie hieKind rm ns = do
50
50
nameSemanticFromRefMap rm' name' = do
51
51
spanInfos <- -- traceShow ("getting spans:", nameString) $
52
52
Map. lookup (Right name') rm'
53
+ -- let combinedFunction x = (identType . snd) x <|> (identInfo . snd) x
54
+ -- let result = foldMap (typeSemantic hieKind) $ listToMaybe $ mapMaybe combinedFunction spanInfos
53
55
let typeTokenType = foldMap (typeSemantic hieKind) $ listToMaybe $ mapMaybe (identType . snd ) spanInfos
54
56
contextInfoTokenType <- foldMap (contextInfosMaybeTokenType . identInfo . snd ) spanInfos
55
57
fold [typeTokenType, Just contextInfoTokenType]
Original file line number Diff line number Diff line change @@ -123,18 +123,7 @@ recoverFunMaskArray flattened = unflattened
123
123
go (HTyConApp _ _) = False
124
124
125
125
126
- realSrcSpanToCodePointRange :: RealSrcSpan -> CodePointRange
127
- realSrcSpanToCodePointRange real =
128
- CodePointRange (realSrcLocToCodePointPosition $ Compat. realSrcSpanStart real)
129
- (realSrcLocToCodePointPosition $ Compat. realSrcSpanEnd real)
130
-
131
-
132
- realSrcLocToCodePointPosition :: RealSrcLoc -> CodePointPosition
133
- realSrcLocToCodePointPosition real =
134
- CodePointPosition (fromIntegral $ srcLocLine real - 1 ) (fromIntegral $ srcLocCol real - 1 )
135
-
136
126
-- rangeToCodePointRange
137
- -- mkRange :: Int -> Int -> Int -> Range
138
127
mkRange :: (Integral a1 , Integral a2 ) => a1 -> a2 -> a2 -> Range
139
128
mkRange startLine startCol len =
140
129
Range (Position (fromIntegral startLine) (fromIntegral startCol)) (Position (fromIntegral startLine) (fromIntegral $ startCol + len))
You can’t perform that action at this time.
0 commit comments