File tree 5 files changed +7
-10
lines changed
ghcide/src/Development/IDE/GHC/Compat
plugins/hls-class-plugin/src/Ide/Plugin/Class 5 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -840,8 +840,6 @@ pattern L l a <- GHC.L (getLoc -> l) a
840
840
type HasSrcSpan = SrcLoc. HasSrcSpan
841
841
getLoc :: SrcLoc. HasSrcSpan a => a -> SrcLoc. SrcSpan
842
842
getLoc = SrcLoc. getLoc
843
- instance HasSrcSpan SrcLoc. SrcSpan where
844
- Development.IDE.GHC.Compat.Core. getLoc = id
845
843
846
844
#else
847
845
@@ -851,8 +849,6 @@ instance HasSrcSpan Name where
851
849
getLoc = nameSrcSpan
852
850
instance HasSrcSpan (SrcLoc. GenLocated SrcSpan a ) where
853
851
getLoc = SrcLoc. getLoc
854
- instance HasSrcSpan SrcSpan where
855
- getLoc = id
856
852
857
853
#endif
858
854
Original file line number Diff line number Diff line change 5
5
6
6
module Ide.Plugin.Class.CodeAction where
7
7
8
+ import Control.Applicative
8
9
import Control.Lens hiding (List , use )
9
10
import Control.Monad.Extra
10
11
import Control.Monad.IO.Class (liftIO )
@@ -178,7 +179,7 @@ minDefToMethodGroups range sigs = go
178
179
where
179
180
go (Var mn) = [[ (T. pack . occNameString . occName $ mn, bindRendered sig)
180
181
| sig <- sigs
181
- , inRange range (getSrcSpan ( bindName sig) )
182
+ , inRange range (getSrcSpan $ bindName sig)
182
183
, printOutputable mn == T. drop (T. length bindingPrefix) (printOutputable (bindName sig))
183
184
]]
184
185
go (Or ms) = concatMap (go . unLoc) ms
Original file line number Diff line number Diff line change @@ -86,8 +86,8 @@ codeLens state plId CodeLensParams{..} = do
86
86
-- Existed signatures' name
87
87
sigNames = concat $ mapMaybe (\ (L _ r) -> getSigName r) cid_sigs
88
88
toBindInfo (L l (L l' _)) = BindInfo
89
- (getLoc l) -- bindSpan
90
- (getLoc l') -- bindNameSpan
89
+ (locA l) -- bindSpan
90
+ (locA l') -- bindNameSpan
91
91
in toBindInfo <$> filter (\ (L _ name) -> unLoc name `notElem` sigNames) bindNames
92
92
getBindSpanWithoutSig _ = []
93
93
Original file line number Diff line number Diff line change @@ -118,5 +118,5 @@ addMethodDecls ps mDecls range withSig = do
118
118
foldM (insertAfter d) ps (reverse decls)
119
119
120
120
findInstDecl :: ParsedSource -> Range -> Transform (LHsDecl GhcPs )
121
- findInstDecl ps range = head . filter (inRange range) <$> hsDecls ps
121
+ findInstDecl ps range = head . filter (inRange range . getLoc ) <$> hsDecls ps
122
122
#endif
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ isBindingName :: Name -> Bool
25
25
isBindingName name = isPrefixOf bindingPrefix $ occNameString $ nameOccName name
26
26
27
27
-- | Check if some `HasSrcSpan` value in the given range
28
- inRange :: HasSrcSpan a => Range -> a -> Bool
29
- inRange range s = maybe False (subRange range) (srcSpanToRange (getLoc s) )
28
+ inRange :: Range -> SrcSpan -> Bool
29
+ inRange range s = maybe False (subRange range) (srcSpanToRange s )
30
30
31
31
ghostSpan :: RealSrcSpan
32
32
ghostSpan = realSrcLocSpan $ mkRealSrcLoc (fsLit " <haskell-language-sever>" ) 1 1
You can’t perform that action at this time.
0 commit comments