@@ -12,6 +12,7 @@ module Wingman.LanguageServer.TacticProviders
12
12
) where
13
13
14
14
import Control.Monad
15
+ import Control.Monad.Reader (runReaderT )
15
16
import Data.Aeson
16
17
import Data.Bool (bool )
17
18
import Data.Coerce
@@ -30,15 +31,13 @@ import Language.LSP.Types
30
31
import OccName
31
32
import Prelude hiding (span )
32
33
import Wingman.Auto
33
- import Wingman.FeatureSet
34
34
import Wingman.GHC
35
35
import Wingman.Judgements
36
36
import Wingman.Machinery (useNameFromHypothesis )
37
37
import Wingman.Metaprogramming.Lexer (ParserContext )
38
38
import Wingman.Metaprogramming.Parser (parseMetaprogram )
39
39
import Wingman.Tactics
40
40
import Wingman.Types
41
- import Control.Monad.Reader (runReaderT )
42
41
43
42
44
43
------------------------------------------------------------------------------
@@ -115,7 +114,6 @@ commandProvider Destruct =
115
114
provide Destruct $ T. pack $ occNameString occ
116
115
commandProvider DestructPun =
117
116
requireHoleSort (== Hole ) $
118
- requireFeature FeatureDestructPun $
119
117
filterBindingType destructPunFilter $ \ occ _ ->
120
118
provide DestructPun $ T. pack $ occNameString occ
121
119
commandProvider Homomorphism =
@@ -134,38 +132,33 @@ commandProvider HomomorphismLambdaCase =
134
132
provide HomomorphismLambdaCase " "
135
133
commandProvider DestructAll =
136
134
requireHoleSort (== Hole ) $
137
- requireFeature FeatureDestructAll $
138
135
withJudgement $ \ jdg ->
139
136
case _jIsTopHole jdg && jHasBoundArgs jdg of
140
137
True -> provide DestructAll " "
141
138
False -> mempty
142
139
commandProvider UseDataCon =
143
140
requireHoleSort (== Hole ) $
144
141
withConfig $ \ cfg ->
145
- requireFeature FeatureUseDataCon $
146
- filterTypeProjection
147
- ( guardLength (<= cfg_max_use_ctor_actions cfg)
148
- . fromMaybe []
149
- . fmap fst
150
- . tacticsGetDataCons
151
- ) $ \ dcon ->
152
- provide UseDataCon
153
- . T. pack
154
- . occNameString
155
- . occName
156
- $ dataConName dcon
142
+ filterTypeProjection
143
+ ( guardLength (<= cfg_max_use_ctor_actions cfg)
144
+ . fromMaybe []
145
+ . fmap fst
146
+ . tacticsGetDataCons
147
+ ) $ \ dcon ->
148
+ provide UseDataCon
149
+ . T. pack
150
+ . occNameString
151
+ . occName
152
+ $ dataConName dcon
157
153
commandProvider Refine =
158
154
requireHoleSort (== Hole ) $
159
- requireFeature FeatureRefineHole $
160
155
provide Refine " "
161
156
commandProvider BeginMetaprogram =
162
157
requireGHC88OrHigher $
163
- requireFeature FeatureMetaprogram $
164
158
requireHoleSort (== Hole ) $
165
159
provide BeginMetaprogram " "
166
160
commandProvider RunMetaprogram =
167
161
requireGHC88OrHigher $
168
- requireFeature FeatureMetaprogram $
169
162
withMetaprogram $ \ mp ->
170
163
provide RunMetaprogram mp
171
164
@@ -213,16 +206,6 @@ data TacticParams = TacticParams
213
206
deriving anyclass (ToJSON , FromJSON )
214
207
215
208
216
- ------------------------------------------------------------------------------
217
- -- | Restrict a 'TacticProvider', making sure it appears only when the given
218
- -- 'Feature' is in the feature set.
219
- requireFeature :: Feature -> TacticProvider -> TacticProvider
220
- requireFeature f tp tpd =
221
- case hasFeature f $ cfg_feature_set $ tpd_config tpd of
222
- True -> tp tpd
223
- False -> pure []
224
-
225
-
226
209
requireHoleSort :: (HoleSort -> Bool ) -> TacticProvider -> TacticProvider
227
210
requireHoleSort p tp tpd =
228
211
case p $ tpd_hole_sort tpd of
0 commit comments