Skip to content

Commit 377e9a1

Browse files
committed
Fix completion test failures for ghc9
With this example: f asdfgh = asd it would suggest to complete `asd` into `asd_arNC`, which seems to be a name it generated because of deferred-out-of-scope-variables
1 parent d0534e6 commit 377e9a1

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ parseFileContents env customPreprocessor filename ms = do
877877
throwE $ diagFromStrings "parser" DsError errs
878878

879879
let preproc_warnings = diagFromStrings "parser" DsWarning preproc_warns
880-
parsed' <- liftIO $ applyPluginsParsedResultAction env dflags ms (hpm_annotations) parsed
880+
parsed' <- liftIO $ applyPluginsParsedResultAction env dflags ms hpm_annotations parsed
881881

882882
-- To get the list of extra source files, we take the list
883883
-- that the parser gave us,

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ module Development.IDE.Spans.LocalBindings
1212
import Control.DeepSeq
1313
import Control.Monad
1414
import Data.Bifunctor
15-
import Data.IntervalMap.FingerTree (IntervalMap, Interval (..))
16-
import qualified Data.IntervalMap.FingerTree as IM
17-
import qualified Data.List as L
18-
import qualified Data.Map as M
19-
import qualified Data.Set as S
20-
import Development.IDE.GHC.Compat (RefMap, identType, identInfo, getScopeFromContext, getBindSiteFromContext, Scope(..), Name, Type)
15+
import Data.IntervalMap.FingerTree (Interval (..), IntervalMap)
16+
import qualified Data.IntervalMap.FingerTree as IM
17+
import qualified Data.List as L
18+
import qualified Data.Map as M
19+
import qualified Data.Set as S
20+
import Development.IDE.GHC.Compat (Name, RefMap, Scope (..), Type,
21+
getBindSiteFromContext,
22+
getScopeFromContext, identInfo,
23+
identType)
2124
import Development.IDE.GHC.Error
2225
import Development.IDE.Types.Location
26+
import Name (isSystemName)
2327
import NameEnv
2428
import SrcLoc
2529

@@ -53,7 +57,7 @@ localBindings refmap = bimap mk mk $ unzip $ do
5357
Just scopes <- pure $ getScopeFromContext info
5458
scope <- scopes >>= \case
5559
LocalScope scope -> pure $ realSrcSpanToInterval scope
56-
_ -> []
60+
_ -> []
5761
pure ( scope
5862
, unitNameEnv name (name,ty)
5963
)
@@ -115,7 +119,8 @@ getDefiningBindings bs rss
115119
-- This is meant for use with the fuzzy `PositionRange` returned by `PositionMapping`
116120
getFuzzyScope :: Bindings -> Position -> Position -> [(Name, Maybe Type)]
117121
getFuzzyScope bs a b
118-
= nameEnvElts
122+
= filter (not . isSystemName . fst)
123+
$ nameEnvElts
119124
$ foldMap snd
120125
$ IM.intersections (Interval a b)
121126
$ getLocalBindings bs

0 commit comments

Comments
 (0)