Skip to content

Extract Development.IDE.GHC.ExactPrint #1203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ packages:
./shake-bench
./ghcide
./hls-plugin-api
./hls-exactprint-utils
./plugins/tactics
./plugins/hls-class-plugin
./plugins/hls-eval-plugin
Expand Down
1 change: 1 addition & 0 deletions ghcide/.hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
- Development.IDE.Core.Compile
- Development.IDE.Core.Rules
- Development.IDE.GHC.Compat
- Development.IDE.GHC.ExactPrint
- Development.IDE.GHC.Orphans
- Development.IDE.GHC.Util
- Development.IDE.Import.FindImports
Expand Down
3 changes: 3 additions & 0 deletions ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ library
fuzzy,
filepath,
fingertree,
ghc-exactprint,
Glob,
haddock-library >= 1.8,
hashable,
Expand All @@ -66,6 +67,7 @@ library
prettyprinter-ansi-terminal,
prettyprinter,
regex-tdfa >= 1.3.1.0,
retrie,
rope-utf16-splay,
safe,
safe-exceptions,
Expand Down Expand Up @@ -144,6 +146,7 @@ library
Development.IDE.Core.Tracing
Development.IDE.GHC.Compat
Development.IDE.GHC.Error
Development.IDE.GHC.ExactPrint
Development.IDE.GHC.Orphans
Development.IDE.GHC.Util
Development.IDE.Import.DependencyInformation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Ide.TreeTransform
module Development.IDE.GHC.ExactPrint
( Graft(..),
graft,
graftDecls,
Expand All @@ -34,6 +30,7 @@ import Control.Monad.Trans.Class
import Control.Monad.Trans.Except
import Control.Monad.Zip
import qualified Data.DList as DL
import Data.Either.Extra (mapLeft)
import Data.Functor.Classes
import Data.Functor.Contravariant
import qualified Data.Text as T
Expand Down Expand Up @@ -309,7 +306,7 @@ annotate :: ASTElement ast => DynFlags -> Located ast -> TransformT (Either Stri
annotate dflags ast = do
uniq <- show <$> uniqueSrcSpanT
let rendered = render dflags ast
(anns, expr') <- lift $ either (Left . show) Right $ parseAST dflags uniq rendered
(anns, expr') <- lift $ mapLeft show $ parseAST dflags uniq rendered
let anns' = setPrecedingLines expr' 0 1 anns
pure (anns', expr')

Expand All @@ -318,7 +315,7 @@ annotateDecl :: DynFlags -> LHsDecl GhcPs -> TransformT (Either String) (Anns, L
annotateDecl dflags ast = do
uniq <- show <$> uniqueSrcSpanT
let rendered = render dflags ast
(anns, expr') <- lift $ either (Left . show) Right $ parseDecl dflags uniq rendered
(anns, expr') <- lift $ mapLeft show $ parseDecl dflags uniq rendered
let anns' = setPrecedingLines expr' 1 0 anns
pure (anns', expr')
------------------------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions hie-cabal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ cradle:
- path: "./hls-plugin-api/src"
component: "lib:hls-plugin-api"

- path: "./hls-exactprint-utils/src"
component: "lib:hls-exactprint-utils"

- path: "./plugins/hls-class-plugin/src"
component: "lib:hls-class-plugin"

Expand Down
3 changes: 0 additions & 3 deletions hie-stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ cradle:
- path: "./hls-plugin-api/src"
component: "hls-plugin-api:lib"

- path: "./hls-exactprint-utils/src"
component: "hls-exactprint-utils:lib"

# Plugins:

- path: "./plugins/hls-class-plugin/src"
Expand Down
201 changes: 0 additions & 201 deletions hls-exactprint-utils/LICENSE

This file was deleted.

50 changes: 0 additions & 50 deletions hls-exactprint-utils/hls-exactprint-utils.cabal

This file was deleted.

1 change: 0 additions & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ let
shake-bench = gitignoreSource ../shake-bench;
hie-compat = gitignoreSource ../hie-compat;
hls-plugin-api = gitignoreSource ../hls-plugin-api;
hls-exactprint-utils = gitignoreSource ../hls-exactprint-utils;
hls-class-plugin = gitignoreSource ../plugins/hls-class-plugin;
hls-haddock-comments-plugin = gitignoreSource ../plugins/hls-haddock-comments-plugin;
hls-eval-plugin = gitignoreSource ../plugins/hls-eval-plugin;
Expand Down
1 change: 0 additions & 1 deletion plugins/hls-splice-plugin/hls-splice-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ library
, hls-plugin-api
, ghc
, ghc-exactprint
, hls-exactprint-utils
, ghcide
, lens
, dlist
Expand Down
2 changes: 1 addition & 1 deletion plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import GhcMonad
import GhcPlugins hiding (Var, getLoc, (<>))
import Ide.Plugin.Splice.Types
import Ide.PluginUtils (mkLspCommand, responseError)
import Ide.TreeTransform
import Development.IDE.GHC.ExactPrint
import Ide.Types
import Language.Haskell.GHC.ExactPrint (TransformT, setPrecedingLines, uniqueSrcSpanT)
import Language.Haskell.LSP.Core
Expand Down
1 change: 0 additions & 1 deletion plugins/tactics/hls-tactics-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ library
, ghcide >=0.1
, haskell-lsp ^>=0.23
, hls-plugin-api
, hls-exactprint-utils
, lens
, mtl
, refinery ^>=0.3
Expand Down
2 changes: 1 addition & 1 deletion plugins/tactics/src/Ide/Plugin/Tactic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import Ide.Plugin.Tactic.Tactics
import Ide.Plugin.Tactic.TestTypes
import Ide.Plugin.Tactic.Types
import Ide.PluginUtils
import Ide.TreeTransform (transform, graft, useAnnotatedSource)
import Development.IDE.GHC.ExactPrint (graft, transform, useAnnotatedSource)
import Ide.Types
import Language.Haskell.LSP.Core (clientCapabilities)
import Language.Haskell.LSP.Types
Expand Down
Loading