Skip to content

Commit 80d9861

Browse files
committed
Compitable fix
1 parent 5dacec9 commit 80d9861

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

ghcide/src/Development/IDE/GHC/Compat/Core.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,8 +840,6 @@ pattern L l a <- GHC.L (getLoc -> l) a
840840
type HasSrcSpan = SrcLoc.HasSrcSpan
841841
getLoc :: SrcLoc.HasSrcSpan a => a -> SrcLoc.SrcSpan
842842
getLoc = SrcLoc.getLoc
843-
instance HasSrcSpan SrcLoc.SrcSpan where
844-
Development.IDE.GHC.Compat.Core.getLoc = id
845843

846844
#else
847845

@@ -851,8 +849,6 @@ instance HasSrcSpan Name where
851849
getLoc = nameSrcSpan
852850
instance HasSrcSpan (SrcLoc.GenLocated SrcSpan a) where
853851
getLoc = SrcLoc.getLoc
854-
instance HasSrcSpan SrcSpan where
855-
getLoc = id
856852

857853
#endif
858854

plugins/hls-class-plugin/src/Ide/Plugin/Class/CodeAction.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
module Ide.Plugin.Class.CodeAction where
77

8+
import Control.Applicative
89
import Control.Lens hiding (List, use)
910
import Control.Monad.Extra
1011
import Control.Monad.IO.Class (liftIO)
@@ -178,7 +179,7 @@ minDefToMethodGroups range sigs = go
178179
where
179180
go (Var mn) = [[ (T.pack . occNameString . occName $ mn, bindRendered sig)
180181
| sig <- sigs
181-
, inRange range (getSrcSpan (bindName sig))
182+
, inRange range (getSrcSpan $ bindName sig)
182183
, printOutputable mn == T.drop (T.length bindingPrefix) (printOutputable (bindName sig))
183184
]]
184185
go (Or ms) = concatMap (go . unLoc) ms

plugins/hls-class-plugin/src/Ide/Plugin/Class/CodeLens.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ codeLens state plId CodeLensParams{..} = do
8686
-- Existed signatures' name
8787
sigNames = concat $ mapMaybe (\(L _ r) -> getSigName r) cid_sigs
8888
toBindInfo (L l (L l' _)) = BindInfo
89-
(getLoc l) -- bindSpan
90-
(getLoc l') -- bindNameSpan
89+
(locA l) -- bindSpan
90+
(locA l') -- bindNameSpan
9191
in toBindInfo <$> filter (\(L _ name) -> unLoc name `notElem` sigNames) bindNames
9292
getBindSpanWithoutSig _ = []
9393

plugins/hls-class-plugin/src/Ide/Plugin/Class/ExactPrint.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,5 @@ addMethodDecls ps mDecls range withSig = do
118118
foldM (insertAfter d) ps (reverse decls)
119119

120120
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
122122
#endif

plugins/hls-class-plugin/src/Ide/Plugin/Class/Utils.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ isBindingName :: Name -> Bool
2525
isBindingName name = isPrefixOf bindingPrefix $ occNameString $ nameOccName name
2626

2727
-- | 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)
3030

3131
ghostSpan :: RealSrcSpan
3232
ghostSpan = realSrcLocSpan $ mkRealSrcLoc (fsLit "<haskell-language-sever>") 1 1

0 commit comments

Comments
 (0)