hls-splice-plugin 1.0.0.6 → 1.0.1.0
raw patch · 3 files changed
+17/−15 lines, 3 filesdep ~ghcidedep ~hls-plugin-apidep ~hls-test-utilsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: ghcide, hls-plugin-api, hls-test-utils
API changes (from Hackage documentation)
- Ide.Plugin.Splice: instance Ide.Plugin.Splice.HasSplice GHC.Hs.Expr.HsExpr
- Ide.Plugin.Splice: instance Ide.Plugin.Splice.HasSplice GHC.Hs.Pat.Pat
- Ide.Plugin.Splice: instance Ide.Plugin.Splice.HasSplice GHC.Hs.Types.HsType
+ Ide.Plugin.Splice: instance Ide.Plugin.Splice.HasSplice Development.IDE.GHC.Compat.Core.AnnListItem GHC.Hs.Expr.HsExpr
+ Ide.Plugin.Splice: instance Ide.Plugin.Splice.HasSplice Development.IDE.GHC.Compat.Core.AnnListItem GHC.Hs.Pat.Pat
+ Ide.Plugin.Splice: instance Ide.Plugin.Splice.HasSplice Development.IDE.GHC.Compat.Core.AnnListItem GHC.Hs.Types.HsType
Files
- hls-splice-plugin.cabal +4/−4
- src/Ide/Plugin/Splice.hs +11/−9
- test/Main.hs +2/−2
hls-splice-plugin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-splice-plugin-version: 1.0.0.6+version: 1.0.1.0 synopsis: HLS Plugin to expand TemplateHaskell Splices and QuasiQuotes @@ -38,8 +38,8 @@ , foldl , ghc , ghc-exactprint- , ghcide ^>=1.5.0- , hls-plugin-api >=1.1 && <1.3+ , ghcide ^>=1.6+ , hls-plugin-api ^>=1.3 , lens , lsp , retrie@@ -64,5 +64,5 @@ , base , filepath , hls-splice-plugin- , hls-test-utils >=1.0 && <1.2+ , hls-test-utils ^>=1.2 , text
src/Ide/Plugin/Splice.hs view
@@ -15,6 +15,8 @@ {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE FlexibleInstances #-} module Ide.Plugin.Splice ( descriptor,@@ -134,7 +136,7 @@ graftSpliceWith :: forall ast.- HasSplice ast =>+ HasSplice AnnListItem ast => Maybe (SrcSpan, Located (ast GhcPs)) -> Maybe (Either String WorkspaceEdit) graftSpliceWith expandeds =@@ -273,27 +275,27 @@ ) data SpliceClass where- OneToOneAST :: HasSplice ast => Proxy# ast -> SpliceClass+ OneToOneAST :: HasSplice AnnListItem ast => Proxy# ast -> SpliceClass IsHsDecl :: SpliceClass -class (Outputable (ast GhcRn), ASTElement (ast GhcPs)) => HasSplice ast where+class (Outputable (ast GhcRn), ASTElement l (ast GhcPs)) => HasSplice l ast where type SpliceOf ast :: Kinds.Type -> Kinds.Type type SpliceOf ast = HsSplice matchSplice :: Proxy# ast -> ast GhcPs -> Maybe (SpliceOf ast GhcPs) expandSplice :: Proxy# ast -> SpliceOf ast GhcPs -> RnM (Either (ast GhcPs) (ast GhcRn), FreeVars) -instance HasSplice HsExpr where+instance HasSplice AnnListItem HsExpr where matchSplice _ (HsSpliceE _ spl) = Just spl matchSplice _ _ = Nothing expandSplice _ = fmap (first Right) . rnSpliceExpr -instance HasSplice Pat where+instance HasSplice AnnListItem Pat where matchSplice _ (SplicePat _ spl) = Just spl matchSplice _ _ = Nothing expandSplice _ = rnSplicePat -instance HasSplice HsType where+instance HasSplice AnnListItem HsType where matchSplice _ (HsSpliceTy _ spl) = Just spl matchSplice _ _ = Nothing expandSplice _ = fmap (first Right) . rnSpliceType@@ -366,8 +368,8 @@ -- | FIXME: Is thereAny "clever" way to do this exploiting TTG? unRenamedE ::- forall ast m.- (Fail.MonadFail m, HasSplice ast) =>+ forall ast m l.+ (Fail.MonadFail m, HasSplice l ast) => DynFlags -> ast GhcRn -> TransformT m (Located (ast GhcPs))@@ -375,7 +377,7 @@ uniq <- show <$> uniqueSrcSpanT (anns, expr') <- either (fail . show) pure $- parseAST @(ast GhcPs) dflags uniq $+ parseAST @_ @(ast GhcPs) dflags uniq $ showSDoc dflags $ ppr expr let _anns' = setPrecedingLines expr' 0 1 anns pure expr'
test/Main.hs view
@@ -83,7 +83,7 @@ theRange = Range { _start = Position 0 0- , _end = Position (length lns + 1) 1+ , _end = Position (fromIntegral $ length lns + 1) 1 } waitForAllProgressDone -- cradle waitForAllProgressDone@@ -104,7 +104,7 @@ testDataDir = "test" </> "testdata" pointRange :: Int -> Int -> Range-pointRange (subtract 1 -> line) (subtract 1 -> col) =+pointRange (subtract 1 -> fromIntegral -> line) (subtract 1 -> fromIntegral -> col) = Range (Position line col) (Position line $ col + 1) -- | Get the title of a code action.