Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ import Development.IDE (Action,
WithPriority,
cmapWithPrio, define,
fromNormalizedFilePath,
hieKind, use_)
import Development.IDE.Core.PluginUtils (runActionE,
hieKind)
import Development.IDE.Core.PluginUtils (runActionE, useE,
useWithStaleE)
import Development.IDE.Core.Rules (toIdeResult)
import Development.IDE.Core.RuleTypes (DocAndTyThingMap (..))
import Development.IDE.Core.Shake (ShakeExtras (..),
getShakeExtras,
getVirtualFile,
useWithStale_)
getVirtualFile)
import Development.IDE.GHC.Compat hiding (Warning)
import Development.IDE.GHC.Compat.Util (mkFastString)
import Ide.Logger (logWith)
Expand Down Expand Up @@ -124,8 +123,8 @@ semanticTokensFullDelta recorder state pid param = do
getSemanticTokensRule :: Recorder (WithPriority SemanticLog) -> Rules ()
getSemanticTokensRule recorder =
define (cmapWithPrio LogShake recorder) $ \GetSemanticTokens nfp -> handleError recorder $ do
(HAR {..}) <- lift $ use_ GetHieAst nfp
(DKMap {getTyThingMap}, _) <- lift $ useWithStale_ GetDocMap nfp
(HAR {..}) <- withExceptT LogDependencyError $ useE GetHieAst nfp
(DKMap {getTyThingMap}, _) <- withExceptT LogDependencyError $ useWithStaleE GetDocMap nfp
ast <- handleMaybe (LogNoAST $ show nfp) $ getAsts hieAst M.!? (HiePath . mkFastString . fromNormalizedFilePath) nfp
virtualFile <- handleMaybeM LogNoVF $ getVirtualFile nfp
let hsFinder = idSemantic getTyThingMap (hieKindFunMasksKind hieKind) refMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import GHC.Generics (Generic)
import Language.LSP.Protocol.Types
-- import template haskell
import Data.Text (Text)
import Ide.Plugin.Error (PluginError)
import Language.Haskell.TH.Syntax (Lift)


Expand Down Expand Up @@ -137,12 +138,12 @@ data HieFunMaskKind kind where

data SemanticLog
= LogShake Shake.Log
| LogDependencyError PluginError
| LogNoAST FilePath
| LogConfig SemanticTokensConfig
| LogMsg String
| LogNoVF
| LogSemanticTokensDeltaMisMatch Text (Maybe Text)
deriving (Show)

instance Pretty SemanticLog where
pretty theLog = case theLog of
Expand All @@ -154,6 +155,7 @@ instance Pretty SemanticLog where
LogSemanticTokensDeltaMisMatch previousIdFromRequest previousIdFromCache
-> "SemanticTokensDeltaMisMatch: previousIdFromRequest: " <> pretty previousIdFromRequest
<> " previousIdFromCache: " <> pretty previousIdFromCache
LogDependencyError err -> "SemanticTokens' dependency error: " <> pretty err


type SemanticTokenId = Text