Skip to content

Commit 432a277

Browse files
committed
WIP only use GetHieAst on dependencies
1 parent 6ad3d06 commit 432a277

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

ghcide/src/Development/IDE/Core/OfInterest.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,22 @@ kick = do
137137
mRunLspT lspEnv $
138138
LSP.sendNotification (LSP.SMethod_CustomMethod msg) $
139139
toJSON $ map fromNormalizedFilePath files
140+
isProjectFile :: NormalizedFilePath -> Bool
141+
isProjectFile file = case getSourceFileOrigin file of
142+
FromProject -> True
143+
FromDependency -> False
144+
projectFiles :: [NormalizedFilePath]
145+
projectFiles = filter isProjectFile files
140146

141147
signal (Proxy @"kick/start")
142148
liftIO $ progressUpdate progress KickStarted
143149

144150
-- Update the exports map
145-
results <- uses GenerateCore files
151+
results <- uses GenerateCore projectFiles
146152
<* uses GetHieAst files
147153
-- needed to have non local completions on the first edit
148154
-- when the first edit breaks the module header
149-
<* uses NonLocalCompletions files
155+
<* uses NonLocalCompletions projectFiles
150156
let mguts = catMaybes results
151157
void $ liftIO $ atomically $ modifyTVar' exportsMap (updateExportsMapMg mguts)
152158

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,11 +1174,19 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
11741174
Just (Succeeded ver v, _) -> Stale Nothing ver v
11751175
Just (Stale d ver v, _) -> Stale d ver v
11761176
Just (Failed b, _) -> Failed b
1177-
(bs, (diags, res)) <- actionCatch
1178-
(do v <- action staleV; liftIO $ evaluate $ force v) $
1179-
\(e :: SomeException) -> do
1180-
pure (Nothing, ([ideErrorText file $ T.pack $ show e | not $ isBadDependency e],Nothing))
1181-
1177+
(bs, (diags, res)) <- do
1178+
let doAction = actionCatch
1179+
(do v <- action staleV; liftIO $ evaluate $ force v) $
1180+
\(e :: SomeException) -> do
1181+
pure (Nothing, ([ideErrorText file $ T.pack $ show e | not $ isBadDependency e],Nothing))
1182+
case getSourceFileOrigin file of
1183+
FromProject -> doAction
1184+
FromDependency -> case eqT @k @GetHieAst of
1185+
Just Refl -> doAction
1186+
Nothing -> error $
1187+
"defineEarlyCutoff': Undefined action for dependency source files\n"
1188+
++ show file ++ "\n"
1189+
++ show key
11821190
ver <- estimateFileVersionUnsafely key res file
11831191
(bs, res) <- case res of
11841192
Nothing -> do

0 commit comments

Comments
 (0)