@@ -13,6 +13,8 @@ import BasicTypes
1313import Control.Monad
1414import Data.Data
1515import Data.List (sortOn)
16+import Data.String (fromString)
17+import FastString as GHC
1618import GHC
1719import Ormolu.Printer.Combinators
1820import Ormolu.Printer.Meat.Common
@@ -22,6 +24,7 @@ import Ormolu.Utils
2224import Outputable (Outputable (..))
2325import SrcLoc (isOneLineSpan)
2426import qualified Data.List.NonEmpty as NE
27+import qualified Data.Text as T
2528
2629data MatchGroupStyle
2730 = Function (Located RdrName)
@@ -383,7 +386,7 @@ p_hsExpr = \case
383386 HsBracket {} -> notImplemented "HsBracket"
384387 HsRnBracketOut {} -> notImplemented "HsRnBracketOut"
385388 HsTcBracketOut {} -> notImplemented "HsTcBracketOut"
386− HsSpliceE {} -> notImplemented "HsSpliceE"
389+ HsSpliceE NoExt splice -> p_hsSplice splice
387390 HsProc {} -> notImplemented "HsProc"
388391 HsStatic _ e -> do
389392 txt "static"
@@ -495,7 +498,7 @@ p_pat = \case
495498 txt " ->"
496499 breakpoint
497500 inci (located pat p_pat)
498− SplicePat {} -> notImplemented "SplicePat"
501+ SplicePat NoExt splice -> p_hsSplice splice
499502 LitPat NoExt p -> atom p
500503 NPat NoExt v _ _ -> located v (atom . ol_val)
501504 NPlusKPat {} -> notImplemented "NPlusKPat"
@@ -514,6 +517,29 @@ p_pat_hsRecField HsRecField {..} = do
514517 breakpoint
515518 inci (located hsRecFieldArg p_pat)
516519
520+p_hsSplice :: HsSplice GhcPs -> R ()
521+p_hsSplice = \case
522+ HsTypedSplice {} -> notImplemented "HsTypedSplice"
523+ HsUntypedSplice {} -> notImplemented "HsUntypedSplice"
524+ HsQuasiQuote NoExt _ quoterName srcSpan str -> do
525+ let locatedQuoterName = L srcSpan quoterName
526+ p_quasiQuote locatedQuoterName $ do
527+ let p x = unless (T.null x) (txt x)
528+ newlineSep (p . T.strip) (T.lines . T.strip . fromString . GHC.unpackFS $ str)
529+ HsSpliced {} -> notImplemented "HsSpliced"
530+ XSplice {} -> notImplemented "XSplice"
531+
532+p_quasiQuote :: Located RdrName -> R () -> R ()
533+p_quasiQuote quoter m = do
534+ txt "["
535+ p_rdrName quoter
536+ txt "|"
537+ let breakpoint' = vlayout (return ()) newline
538+ breakpoint'
539+ inci m
540+ breakpoint'
541+ txt "|]"
542+
517543----------------------------------------------------------------------------
518544-- Helpers
519545