Skip to content

Commit

Permalink
Remove dead code in ghcide and hls-graph for priority (#4151)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed Mar 25, 2024
1 parent e9ee544 commit 3668683
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 29 deletions.
16 changes: 1 addition & 15 deletions ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
module Development.IDE.Core.Rules(
-- * Types
IdeState, GetParsedModule(..), TransitiveDependencies(..),
Priority(..), GhcSessionIO(..), GetClientSettings(..),
GhcSessionIO(..), GetClientSettings(..),
-- * Functions
priorityTypeCheck,
priorityGenerateCore,
priorityFilesOfInterest,
runAction,
toIdeResult,
defineNoFile,
Expand Down Expand Up @@ -250,15 +247,6 @@ getParsedModuleWithComments = use GetParsedModuleWithComments
-- Rules
-- These typically go from key to value and are oracles.

priorityTypeCheck :: Priority
priorityTypeCheck = Priority 0

priorityGenerateCore :: Priority
priorityGenerateCore = Priority (-1)

priorityFilesOfInterest :: Priority
priorityFilesOfInterest = Priority (-2)

-- | WARNING:
-- We currently parse the module both with and without Opt_Haddock, and
-- return the one with Haddocks if it -- succeeds. However, this may not work
Expand Down Expand Up @@ -682,7 +670,6 @@ typeCheckRuleDefinition
-> ParsedModule
-> Action (IdeResult TcModuleResult)
typeCheckRuleDefinition hsc pm = do
setPriority priorityTypeCheck
IdeOptions { optDefer = defer } <- getIdeOptions

unlift <- askUnliftIO
Expand Down Expand Up @@ -936,7 +923,6 @@ generateCore :: RunSimplifier -> NormalizedFilePath -> Action (IdeResult ModGuts
generateCore runSimplifier file = do
packageState <- hscEnv <$> use_ GhcSessionDeps file
tm <- use_ TypeCheck file
setPriority priorityGenerateCore
liftIO $ compileModule runSimplifier packageState (tmrModSummary tm) (tmrTypechecked tm)

generateCoreRule :: Recorder (WithPriority Log) -> Rules ()
Expand Down
7 changes: 0 additions & 7 deletions ghcide/src/Development/IDE/Core/Shake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ module Development.IDE.Core.Shake(
HLS.getClientConfig,
getPluginConfigAction,
knownTargets,
setPriority,
ideLogger,
actionLogger,
getVirtualFile,
FileVersion(..),
Priority(..),
updatePositionMapping,
updatePositionMappingHelper,
deleteValue, recordDirtyKeys,
Expand Down Expand Up @@ -1307,11 +1305,6 @@ updateFileDiagnostics recorder fp ver k ShakeExtras{diagnostics, hiddenDiagnosti
| otherwise = c


newtype Priority = Priority Double

setPriority :: Priority -> Action ()
setPriority (Priority p) = reschedule p

ideLogger :: IdeState -> Logger
ideLogger IdeState{shakeExtras=ShakeExtras{logger}} = logger

Expand Down
2 changes: 0 additions & 2 deletions hls-graph/src/Development/IDE/Graph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ module Development.IDE.Graph(
ShakeValue, RuleResult,
-- * Special rules
alwaysRerun,
-- * Batching
reschedule,
-- * Actions for inspecting the keys in the database
getDirtySet,
getKeysAndVisitedAge,
Expand Down
5 changes: 0 additions & 5 deletions hls-graph/src/Development/IDE/Graph/Internal/Action.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module Development.IDE.Graph.Internal.Action
, apply
, applyWithoutDependency
, parallel
, reschedule
, runActions
, Development.IDE.Graph.Internal.Action.getDirtySet
, getKeysAndVisitedAge
Expand Down Expand Up @@ -41,10 +40,6 @@ alwaysRerun = do
ref <- Action $ asks actionDeps
liftIO $ modifyIORef' ref (AlwaysRerunDeps mempty <>)

-- No-op for now
reschedule :: Double -> Action ()
reschedule _ = pure ()

parallel :: [Action a] -> Action [a]
parallel [] = pure []
parallel [x] = fmap (:[]) x
Expand Down

0 comments on commit 3668683

Please sign in to comment.