File tree 3 files changed +5
-3
lines changed
3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ getAtPoint file pos = runMaybeT $ do
77
77
mergeContent Nothing x@ Just {} = x
78
78
mergeContent (Just (r1, txt1)) (Just (r2, txt2)) =
79
79
if r1 == r2
80
- then Just (r1, txt1 <> txt2)
80
+ then Just (r1, txt1 <> filter ( not . T. null ) txt2)
81
81
else Just (r1, txt1)
82
82
83
83
toCurrentLocations :: PositionMapping -> [Location ] -> [Location ]
Original file line number Diff line number Diff line change @@ -217,7 +217,8 @@ fixityAtPoint (HAR _ hf _ _ _) env tcGblEnv pos = fmap listToMaybe $ sequence $
217
217
fixityInfo ast = do
218
218
let range = realSrcSpanToRange $ nodeSpan ast
219
219
names = mapMaybe eitherToMaybe $ M. keys $ getNodeIds ast
220
- getFixity names >>= (\ fixities -> pure (Just range, [toHoverContent fixities]))
220
+ fixities <- getFixity names
221
+ pure (Just range, [toHoverContent fixities])
221
222
222
223
-- We use `handleGhcException` here to prevent hover crashed.
223
224
-- Because `runTcInteractive` may throw an exception if something
Original file line number Diff line number Diff line change @@ -6550,10 +6550,11 @@ hoverFixityTests = testGroup "Explicit fixity"
6550
6550
, hoverTest " signature" (Position 35 2 ) " infixr 9 `>>>:`"
6551
6551
, hoverTest " operator" (Position 36 2 ) " infixr 9 `>>>:`"
6552
6552
, hoverTest " escape" (Position 39 2 ) " infixl 3 `~\\ :`"
6553
+ , expectFail $ hoverTest " import" (Position 2 18 ) " Control.Monad***"
6553
6554
-- It will cause error like: "Failed to load interface for \8216Fixity\8217\nIt is not a module in the current program, or in any known package."
6554
6555
-- while we look up fixities from imported local defined module, see test below.
6555
6556
, expectFailBecause " Not support yet"
6556
- $ hoverTestImport " import " (Position 4 7 ) " infixr 9 `>>>:`"
6557
+ $ hoverTestImport " imported " (Position 4 7 ) " infixr 9 `>>>:`"
6557
6558
]
6558
6559
where
6559
6560
hoverTest = hoverTest' " Fixity.hs"
You can’t perform that action at this time.
0 commit comments