Skip to content

Use stale data in explicit imports lens #383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2020
Merged
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
7 changes: 4 additions & 3 deletions src/Ide/Plugin/ImportLens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import qualified Data.Map.Strict as Map
import Data.Maybe (catMaybes, fromMaybe)
import qualified Data.Text as T
import Development.IDE
import Development.IDE.Core.Shake (useWithStale)
import Development.IDE.GHC.Compat
import GHC.Generics (Generic)
import Ide.Plugin
Expand Down Expand Up @@ -84,11 +85,11 @@ provider _lspFuncs -- LSP functions, not used
| Just nfp <- uriToNormalizedFilePath $ toNormalizedUri _uri
= do
-- Get the typechecking artifacts from the module
tmr <- runIde state $ use TypeCheck nfp
tmr <- runIde state $ useWithStale TypeCheck nfp
-- We also need a GHC session with all the dependencies
hsc <- runIde state $ use GhcSessionDeps nfp
hsc <- runIde state $ useWithStale GhcSessionDeps nfp
-- Use the GHC api to extract the "minimal" imports
(imports, mbMinImports) <- extractMinimalImports hsc tmr
(imports, mbMinImports) <- extractMinimalImports (fst <$> hsc) ( fst <$> tmr)

case mbMinImports of
-- Implement the provider logic:
Expand Down