Skip to content

Commit 7565509

Browse files
committed
Create Types module to reduce test dependencies
1 parent 9cf7d5b commit 7565509

File tree

3 files changed

+14
-27
lines changed

3 files changed

+14
-27
lines changed

haskell-language-server.cabal

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ executable haskell-language-server
9292
Ide.Plugin.Pragmas
9393
Ide.Plugin.Retrie
9494
Ide.Plugin.StylishHaskell
95+
Ide.LocalBindings
96+
Ide.Plugin.Tactic
97+
Ide.Plugin.Tactic.Types
98+
Ide.Plugin.Tactic.Machinery
99+
Ide.Plugin.Tactic.Tactics
100+
Ide.TreeTransform
95101

96102
ghc-options:
97103
-threaded -Wall -Wno-name-shadowing -Wredundant-constraints
@@ -142,6 +148,9 @@ executable haskell-language-server
142148
, time
143149
, transformers
144150
, unordered-containers
151+
, ghc-source-gen
152+
, refinery
153+
, ghc-exactprint
145154

146155
if flag(agpl)
147156
build-depends: brittany
@@ -230,7 +239,7 @@ test-suite func-test
230239
, tasty-golden
231240
, tasty-rerun
232241

233-
hs-source-dirs: test/functional
242+
hs-source-dirs: test/functional plugins/default/src
234243
main-is: Main.hs
235244
other-modules:
236245
Command
@@ -250,6 +259,8 @@ test-suite func-test
250259
Rename
251260
Symbol
252261
TypeDefinition
262+
Tactic
263+
Ide.Plugin.Tactic.Types
253264

254265
ghc-options:
255266
-Wall -Wno-name-shadowing -threaded -rtsopts -with-rtsopts=-N

plugins/default/src/Ide/Plugin/Tactic.hs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import Ide.LocalBindings (bindings, mostSpecificSpan, holify)
3636
import Ide.Plugin (mkLspCommand)
3737
import Ide.Plugin.Tactic.Machinery
3838
import Ide.Plugin.Tactic.Tactics
39+
import Ide.Plugin.Tactic.Types
3940
import Ide.TreeTransform (transform, graft, useAnnotatedSource)
4041
import Ide.Types
4142
import Language.Haskell.LSP.Core (clientCapabilities)
@@ -60,23 +61,10 @@ tacticDesc :: T.Text -> T.Text
6061
tacticDesc name = "fill the hole using the " <> name <> " tactic"
6162

6263
------------------------------------------------------------------------------
63-
-- | The list of tactics exposed to the outside world. These are attached to
64-
-- actual tactics via 'commandTactic' and are contextually provided to the
65-
-- editor via 'commandProvider'.
66-
data TacticCommand
67-
= Auto
68-
| Split
69-
| Intro
70-
| Intros
71-
| Destruct
72-
| Homomorphism
73-
deriving (Eq, Ord, Show, Enum, Bounded)
74-
7564

7665
enabledTactics :: [TacticCommand]
7766
enabledTactics = [Intros, Destruct, Homomorphism]
7867

79-
8068
------------------------------------------------------------------------------
8169
-- | A 'TacticProvider' is a way of giving context-sensitive actions to the LS
8270
-- UI.
@@ -94,18 +82,6 @@ tcCommandId c = coerce $ T.pack $ "tactics" <> show c <> "Command"
9482
tcCommandName :: TacticCommand -> T.Text
9583
tcCommandName = T.pack . show
9684

97-
98-
------------------------------------------------------------------------------
99-
-- | Generate a title for the command.
100-
tacticTitle :: TacticCommand -> T.Text -> T.Text
101-
tacticTitle Auto _ = "Auto"
102-
tacticTitle Split _ = "Auto"
103-
tacticTitle Intro _ = "Intro"
104-
tacticTitle Intros _ = "Introduce lambda"
105-
tacticTitle Destruct var = "Case split on " <> var
106-
tacticTitle Homomorphism var = "Homomorphic case split on " <> var
107-
108-
10985
------------------------------------------------------------------------------
11086
-- | Mapping from tactic commands to their contextual providers. See 'provide',
11187
-- 'filterGoalType' and 'filterBindingType' for the nitty gritty.

test/functional/Tactic.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Test.Hls.Util
2222
import Test.Tasty
2323
import Test.Tasty.HUnit
2424
import Data.Maybe (mapMaybe)
25-
import Ide.Plugin.Tactic (tacticTitle, TacticCommand (..))
25+
import Ide.Plugin.Tactic.Types (tacticTitle, TacticCommand (..))
2626

2727

2828
------------------------------------------------------------------------------

0 commit comments

Comments
 (0)