Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ highlightAtPoint file pos = runMaybeT $ do
AtPoint.documentHighlight hf rf pos'

getHieFile
:: IdeState
:: ShakeExtras
-> NormalizedFilePath -- ^ file we're editing
-> Module -- ^ module dep we want info for
-> MaybeT IdeAction (HieFile, FilePath) -- ^ hie stuff for the module
Expand Down Expand Up @@ -197,7 +197,7 @@ getHomeHieFile f = do
MaybeT $ pure $ join mhf


getPackageHieFile :: IdeState
getPackageHieFile :: ShakeExtras
-> Module -- ^ Package Module to load .hie file for
-> NormalizedFilePath -- ^ Path of home module importing the package module
-> MaybeT IdeAction (HieFile, FilePath)
Expand Down
4 changes: 2 additions & 2 deletions src/Development/IDE/Core/Service.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ getIdeOptions = do
GlobalIdeOptions x <- getIdeGlobalAction
return x

getIdeOptionsIO :: IdeState -> IO IdeOptions
getIdeOptionsIO :: ShakeExtras -> IO IdeOptions
getIdeOptionsIO ide = do
GlobalIdeOptions x <- getIdeGlobalState ide
GlobalIdeOptions x <- getIdeGlobalExtras ide
return x
11 changes: 6 additions & 5 deletions src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module Development.IDE.Core.Shake(
getDiagnostics, unsafeClearDiagnostics,
getHiddenDiagnostics,
IsIdeGlobal, addIdeGlobal, addIdeGlobalExtras, getIdeGlobalState, getIdeGlobalAction,
getIdeGlobalExtras,
garbageCollect,
knownFiles,
setPriority,
Expand Down Expand Up @@ -614,7 +615,7 @@ shakeShut IdeState{..} = withMVar shakeAbort $ \stop -> do
-- has already finished as is the case with useWithStaleFast
delayedAction :: DelayedAction () -> IdeAction ()
delayedAction a = do
sq <- shakeQueue <$> ask
sq <- queue <$> ask
void $ liftIO $ queueAction [a] sq

-- | A varient of delayedAction for the Action monad
Expand Down Expand Up @@ -736,16 +737,16 @@ useWithStale :: IdeRule k v
=> k -> NormalizedFilePath -> Action (Maybe (v, PositionMapping))
useWithStale key file = head <$> usesWithStale key [file]

newtype IdeAction a = IdeAction { runIdeActionT :: (ReaderT IdeState IO) a }
deriving (MonadReader IdeState, MonadIO, Functor, Applicative, Monad)
newtype IdeAction a = IdeAction { runIdeActionT :: (ReaderT ShakeExtras IO) a }
deriving (MonadReader ShakeExtras, MonadIO, Functor, Applicative, Monad)

runIdeAction :: String -> IdeState -> IdeAction a -> IO a
runIdeAction :: String -> ShakeExtras -> IdeAction a -> IO a
runIdeAction _herald s i = do
res <- runReaderT (runIdeActionT i) s
return res

askShake :: IdeAction ShakeExtras
askShake = shakeExtras <$> ask
askShake = ask

mkUpdater :: MaybeT IdeAction NameCacheUpdater
mkUpdater = do
Expand Down
2 changes: 1 addition & 1 deletion src/Development/IDE/LSP/HoverDefinition.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ logAndRunRequest label getResults ide pos path = do
logInfo (ideLogger ide) $
label <> " request at position " <> T.pack (showPosition pos) <>
" in file: " <> T.pack path
runIdeAction (T.unpack label) ide (getResults filePath pos)
runIdeAction (T.unpack label) (shakeExtras ide) (getResults filePath pos)
2 changes: 1 addition & 1 deletion src/Development/IDE/LSP/Outline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ moduleOutline
moduleOutline _lsp ideState DocumentSymbolParams { _textDocument = TextDocumentIdentifier uri }
= case uriToFilePath uri of
Just (toNormalizedFilePath' -> fp) -> do
mb_decls <- fmap fst <$> runIdeAction "Outline" ideState (useWithStaleFast GetParsedModule fp)
mb_decls <- fmap fst <$> runIdeAction "Outline" (shakeExtras ideState) (useWithStaleFast GetParsedModule fp)
pure $ Right $ case mb_decls of
Nothing -> DSDocumentSymbols (List [])
Just ParsedModule { pm_parsed_source = L _ltop HsModule { hsmodName, hsmodDecls, hsmodImports } }
Expand Down
2 changes: 1 addition & 1 deletion src/Development/IDE/Plugin/CodeAction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ codeLens _lsp ideState CodeLensParams{_textDocument=TextDocumentIdentifier uri}
fmap (Right . List) $ case uriToFilePath' uri of
Just (toNormalizedFilePath' -> filePath) -> do
-- Needs to be delayed action
_ <- runIdeAction "codeLens" ideState $ (runMaybeT $ useE TypeCheck filePath)
_ <- runIdeAction "codeLens" (shakeExtras ideState) $ (runMaybeT $ useE TypeCheck filePath)
diag <- getDiagnostics ideState
hDiag <- getHiddenDiagnostics ideState
pure
Expand Down
4 changes: 2 additions & 2 deletions src/Development/IDE/Plugin/Completions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ getCompletionsLSP lsp ide
fmap Right $ case (contents, uriToFilePath' uri) of
(Just cnts, Just path) -> do
let npath = toNormalizedFilePath' path
(ideOpts, compls) <- runIdeAction "Completion" ide $ do
opts <- liftIO $ getIdeOptionsIO ide
(ideOpts, compls) <- runIdeAction "Completion" (shakeExtras ide) $ do
opts <- liftIO $ getIdeOptionsIO $ shakeExtras ide
compls <- useWithStaleFast ProduceCompletions npath
pm <- useWithStaleFast GetParsedModule npath
pure (opts, liftA2 (,) compls pm)
Expand Down