Skip to content

Commit 50ebb2d

Browse files
committed
HLS Ecta plugin
1 parent 5d35a74 commit 50ebb2d

File tree

5 files changed

+72
-1
lines changed

5 files changed

+72
-1
lines changed

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ packages:
3131
./plugins/hls-code-range-plugin
3232
./plugins/hls-change-type-signature-plugin
3333
./plugins/hls-stan-plugin
34+
./plugins/hls-ecta-plugin
3435
./plugins/hls-gadt-plugin
3536
./plugins/hls-explicit-fixity-plugin
3637
./plugins/hls-refactor-plugin

haskell-language-server.cabal

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ flag haddockComments
7777
default: True
7878
manual: True
7979

80+
flag ecta
81+
description: Enable ecta plugin
82+
default: True
83+
manual: True
84+
8085
flag eval
8186
description: Enable eval plugin
8287
default: True
@@ -214,6 +219,11 @@ common haddockComments
214219
build-depends: hls-haddock-comments-plugin ^>= 1.1
215220
cpp-options: -Dhls_haddockComments
216221

222+
common ecta
223+
if flag(ecta) && (impl(ghc < 9) || flag(ignore-plugins-ghc-bounds))
224+
build-depends: hls-ecta-plugin
225+
cpp-options: -Dhls_ecta
226+
217227
common eval
218228
if flag(eval) && (impl(ghc < 9.4.1) || flag(ignore-plugins-ghc-bounds))
219229
build-depends: hls-eval-plugin ^>= 1.3
@@ -270,7 +280,7 @@ common splice
270280
cpp-options: -Dhls_splice
271281

272282
common alternateNumberFormat
273-
if flag(alternateNumberFormat)
283+
if flag(alternateNumberFormat)
274284
build-depends: hls-alternate-number-format-plugin ^>= 1.2
275285
cpp-options: -Dhls_alternateNumberFormat
276286

@@ -341,6 +351,7 @@ library
341351
, changeTypeSignature
342352
, class
343353
, haddockComments
354+
, ecta
344355
, eval
345356
, importLens
346357
, refineImports
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module Ide.Plugin.Ecta (descriptor) where
2+
3+
import Development.IDE.GHC.Compat
4+
import Development.IDE.GHC.Compat.Util
5+
import qualified Ecta.Plugin as Ecta
6+
import Ide.Types
7+
8+
descriptor :: Recorder (WithPriority Log) -> PluginId -> PluginDescriptor IdeState
9+
descriptor recorder pluginId = (defaultPluginDescriptor pluginId)
10+
{ pluginModifyDynflags = staticPlugin
11+
}
12+
13+
staticPlugin :: DynFlagsModifications
14+
staticPlugin = mempty
15+
{ dynFlagsModifyGlobal = \df -> df
16+
{ staticPlugins = staticPlugins df <> [metaprogrammingPlugin]
17+
}
18+
}
19+
20+
ectaPlugin :: StaticPlugin
21+
ectaPlugin = StaticPlugin $ PluginWithArgs Ecta.plugin []
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cabal-version: 2.2
2+
name: hls-ecta-plugin
3+
version: 1.0
4+
synopsis: Code synthesis for typed holes via ECTA
5+
description:
6+
Please see the README on GitHub at <https://github.com/haskell/haskell-language-server#readme>
7+
license: Apache-2.0
8+
license-file: LICENSE
9+
author: Pepe Iborra
10+
maintainer: pepeiborra@gmail.com
11+
category: Development
12+
build-type: Simple
13+
extra-source-files:
14+
LICENSE
15+
16+
library
17+
if impl(ghc > 8.9) && impl(ghc < 9.0)
18+
buildable: True
19+
else
20+
buildable: False
21+
exposed-modules: Ide.Plugin.Ecta
22+
hs-source-dirs: src
23+
build-depends:
24+
base >=4.12 && <5
25+
, ecta
26+
, ecta-plugin
27+
, ghcide >=1.8
28+
, hls-graph
29+
, hls-plugin-api >=1.4
30+
31+
default-language: Haskell2010

src/HlsPlugins.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import qualified Ide.Plugin.Class as Class
2929
import qualified Ide.Plugin.HaddockComments as HaddockComments
3030
#endif
3131

32+
#if hls_ecta
33+
import qualified Ide.Plugin.Ecta as Ecta
34+
#endif
35+
3236
#if hls_eval
3337
import qualified Ide.Plugin.Eval as Eval
3438
#endif
@@ -173,6 +177,9 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
173177
#if hls_haddockComments
174178
HaddockComments.descriptor pluginRecorder "haddockComments" :
175179
#endif
180+
#if hls_ecta
181+
Ecta.descriptor pluginRecorder "ecta" :
182+
#endif
176183
#if hls_eval
177184
Eval.descriptor pluginRecorder "eval" :
178185
#endif

0 commit comments

Comments
 (0)