diff --git a/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Internal.hs b/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Internal.hs index 1be1b523b6..b8b07e667f 100644 --- a/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Internal.hs +++ b/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Internal.hs @@ -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) @@ -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 diff --git a/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Types.hs b/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Types.hs index d7cf2a2b50..cda4fda6e6 100644 --- a/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Types.hs +++ b/plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Types.hs @@ -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) @@ -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 @@ -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