Skip to content

Commit a3a94a2

Browse files
committed
Address review comments
1 parent e64e4b1 commit a3a94a2

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import Development.IDE.Core.PositionMapping
2424
import Development.IDE.Core.RuleTypes
2525
import Development.IDE.Core.Service
2626
import Development.IDE.Core.Shake
27+
import Development.IDE.GHC.Compat (DynFlags (..),
28+
ms_hspp_opts)
2729
import Development.IDE.Graph
2830
import qualified Development.IDE.Spans.AtPoint as AtPoint
2931
import Development.IDE.Types.HscEnvEq (hscEnv)
@@ -52,13 +54,14 @@ getAtPoint file pos = runMaybeT $ do
5254
shakeExtras <- lift askShake
5355

5456
env <- hscEnv . fst <$> useWithStaleFastMT GhcSession file
55-
parsedModule <- fst <$> useWithStaleFastMT GetParsedModule file
57+
modSummary <- fst <$> useWithStaleFastMT GetModSummary file
5658
dkMap <- lift $ maybe (DKMap mempty mempty mempty) fst <$> runMaybeT (useWithStaleFastMT GetDocMap file)
59+
let enabledExtensions = extensionFlags (ms_hspp_opts (msrModSummary modSummary))
5760

5861
!pos' <- MaybeT (return $ fromCurrentPosition mapping pos)
5962

6063
MaybeT $ liftIO $ fmap (first (toCurrentRange mapping =<<)) <$>
61-
AtPoint.atPoint opts shakeExtras hf dkMap env pos' parsedModule
64+
AtPoint.atPoint opts shakeExtras hf dkMap env pos' enabledExtensions
6265

6366
-- | Converts locations in the source code to their current positions,
6467
-- taking into account changes that may have occurred due to edits.

ghcide/src/Development/IDE/Spans/AtPoint.hs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ import Development.IDE.Core.PositionMapping
4141
import Development.IDE.Core.RuleTypes
4242
import Development.IDE.GHC.Compat
4343
import qualified Development.IDE.GHC.Compat.Util as Util
44-
import Development.IDE.GHC.Util (getExtensions,
45-
getExtensionsSet,
46-
printOutputable,
44+
import Development.IDE.GHC.Util (printOutputable,
4745
printOutputableOneLine)
4846
import Development.IDE.Spans.Common
4947
import Development.IDE.Types.Options
@@ -71,12 +69,9 @@ import qualified Data.Set as S
7169
import Data.Tree
7270
import qualified Data.Tree as T
7371
import Data.Version (showVersion)
74-
import Debug.Trace (traceShow, traceShowId)
7572
import Development.IDE.Core.LookupMod (LookupModule, lookupMod)
76-
import Development.IDE.Core.PluginUtils (runActionE)
7773
import Development.IDE.Core.Shake (ShakeExtras (..),
78-
runIdeAction, use,
79-
useWithStaleFast)
74+
runIdeAction)
8075
import Development.IDE.Types.Shake (WithHieDb)
8176
import GHC.Iface.Ext.Types (EvVarSource (..),
8277
HieAST (..),
@@ -266,9 +261,9 @@ atPoint
266261
-> DocAndTyThingMap
267262
-> HscEnv
268263
-> Position
269-
-> ParsedModule
264+
-> Util.EnumSet Extension
270265
-> IO (Maybe (Maybe Range, [T.Text]))
271-
atPoint opts@IdeOptions{} shakeExtras@ShakeExtras{ withHieDb, hiedbWriter } har@(HAR _ (hf :: HieASTs a) rf _ (kind :: HieKind hietype)) (DKMap dm km _am) env pos parsedModule =
266+
atPoint opts@IdeOptions{} shakeExtras@ShakeExtras{ withHieDb, hiedbWriter } har@(HAR _ (hf :: HieASTs a) rf _ (kind :: HieKind hietype)) (DKMap dm km _am) env pos enabledExtensions =
272267
listToMaybe <$> sequence (pointCommand hf pos hoverInfo)
273268
where
274269
-- Hover info for values/data
@@ -288,9 +283,6 @@ atPoint opts@IdeOptions{} shakeExtras@ShakeExtras{ withHieDb, hiedbWriter } har@
288283
prettyNames <- mapM (prettyName locationsMap) names
289284
pure (Just range, prettyNames ++ pTypes locationsMap)
290285
where
291-
enabledExtensions :: Util.EnumSet Extension
292-
enabledExtensions = getExtensionsSet $ parsedModule
293-
294286
pTypes :: M.Map Name Location -> [T.Text]
295287
pTypes locationsMap =
296288
case names of

ghcide/src/Development/IDE/Spans/Common.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import Language.LSP.Protocol.Types
3838
type DocMap = NameEnv SpanDoc
3939
type TyThingMap = NameEnv TyThing
4040
type ArgDocMap = NameEnv (IntMap SpanDoc)
41-
data A = A Word Bool
4241

4342
-- | Shows IEWrappedName, without any modifier, qualifier or unique identifier.
4443
unqualIEWrapName :: IEWrappedName GhcPs -> T.Text

0 commit comments

Comments
 (0)