1{-# LANGUAGE CPP               #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Plugins where
4
5import           Ide.PluginUtils                   (pluginDescToIdePlugins)
6import           Ide.Types                         (IdePlugins)
7
8-- fixed plugins
9import           Development.IDE                   (IdeState)
10import           Development.IDE.Plugin.HLS.GhcIde as GhcIde
11import           Ide.Plugin.Example                as Example
12import           Ide.Plugin.Example2               as Example2
13
14-- haskell-language-server optional plugins
15
16#if callHierarchy
17import           Ide.Plugin.CallHierarchy          as CallHierarchy
18#endif
19
20#if class
21import           Ide.Plugin.Class                  as Class
22#endif
23
24#if haddockComments
25import           Ide.Plugin.HaddockComments        as HaddockComments
26#endif
27
28#if eval
29import           Ide.Plugin.Eval                   as Eval
30#endif
31
32#if importLens
33import           Ide.Plugin.ExplicitImports        as ExplicitImports
34#endif
35
36#if refineImports
37import           Ide.Plugin.RefineImports          as RefineImports
38#endif
39
40#if rename
41import           Ide.Plugin.Rename                 as Rename
42#endif
43
44#if retrie
45import           Ide.Plugin.Retrie                 as Retrie
46#endif
47
48#if tactic
49import           Ide.Plugin.Tactic                 as Tactic
50#endif
51
52#if hlint
53import           Ide.Plugin.Hlint                  as Hlint
54#endif
55
56#if moduleName
57import           Ide.Plugin.ModuleName             as ModuleName
58#endif
59
60#if pragmas
61import           Ide.Plugin.Pragmas                as Pragmas
62#endif
63
64#if splice
65import           Ide.Plugin.Splice                 as Splice
66#endif
67
68-- formatters
69
70#if floskell
71import           Ide.Plugin.Floskell               as Floskell
72#endif
73
74#if fourmolu
75import           Ide.Plugin.Fourmolu               as Fourmolu
76#endif
77
78#if ormolu
79import           Ide.Plugin.Ormolu                 as Ormolu
80#endif
81
82#if stylishHaskell
83import           Ide.Plugin.StylishHaskell         as StylishHaskell
84#endif
85
86#if brittany
87import           Ide.Plugin.Brittany               as Brittany
88#endif
89
90-- ---------------------------------------------------------------------
91
92-- | The plugins configured for use in this instance of the language
93-- server.
94-- These can be freely added or removed to tailor the available
95-- features of the server.
96
97idePlugins :: Bool -> IdePlugins IdeState
98idePlugins includeExamples = pluginDescToIdePlugins allPlugins
99  where
100    allPlugins = if includeExamples
101                   then basePlugins ++ examplePlugins
102                   else basePlugins
103    basePlugins =
104#if pragmas
105      Pragmas.descriptor  "pragmas" :
106#endif
107#if floskell
108      Floskell.descriptor "floskell" :
109#endif
110#if fourmolu
111      Fourmolu.descriptor "fourmolu" :
112#endif
113#if tactic
114      Tactic.descriptor "tactics" :
115#endif
116#if ormolu
117      Ormolu.descriptor   "ormolu" :
118#endif
119#if stylishHaskell
120      StylishHaskell.descriptor "stylish-haskell" :
121#endif
122#if rename
123      Rename.descriptor "rename" :
124#endif
125#if retrie
126      Retrie.descriptor "retrie" :
127#endif
128#if brittany
129      Brittany.descriptor "brittany" :
130#endif
131#if callHierarchy
132      CallHierarchy.descriptor "callHierarchy":
133#endif
134#if class
135      Class.descriptor "class" :
136#endif
137#if haddockComments
138      HaddockComments.descriptor "haddockComments" :
139#endif
140#if eval
141      Eval.descriptor "eval" :
142#endif
143#if importLens
144      ExplicitImports.descriptor "importLens" :
145#endif
146#if refineImports
147      RefineImports.descriptor "refineImports" :
148#endif
149#if moduleName
150      ModuleName.descriptor "moduleName" :
151#endif
152#if hlint
153      Hlint.descriptor "hlint" :
154#endif
155#if splice
156      Splice.descriptor "splice" :
157#endif
158    -- The ghcide descriptors should come last so that the notification handlers
159    -- (which restart the Shake build) run after everything else
160      GhcIde.descriptors
161    examplePlugins =
162      [Example.descriptor  "eg"
163      ,Example2.descriptor "eg2"
164      ]
165