@@ -6,11 +6,12 @@ module HlsPlugins where
6
6
import Development.IDE.Types.Logger (Pretty (pretty ), Recorder ,
7
7
WithPriority , cmapWithPrio )
8
8
import Ide.PluginUtils (pluginDescToIdePlugins )
9
- import Ide.Types (IdePlugins )
9
+ import Ide.Types (IdePlugins , PluginId )
10
10
11
11
-- fixed plugins
12
12
import Development.IDE (IdeState )
13
13
import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
14
+ import GHC.Exts (fromString )
14
15
15
16
-- haskell-language-server optional plugins
16
17
#if hls_qualifyImportedNames
@@ -119,10 +120,10 @@ import qualified Ide.Plugin.Brittany as Brittany
119
120
import qualified Development.IDE.Plugin.CodeAction as Refactor
120
121
#endif
121
122
122
- data Log = forall a . (Pretty a ) => Log a
123
+ data Log = forall a . (Pretty a ) => Log PluginId a
123
124
124
125
instance Pretty Log where
125
- pretty (Log a) = pretty a
126
+ pretty (Log pId a) = fromString ( show pId) <> " : " <> pretty a
126
127
127
128
-- ---------------------------------------------------------------------
128
129
@@ -134,8 +135,8 @@ instance Pretty Log where
134
135
idePlugins :: Recorder (WithPriority Log ) -> IdePlugins IdeState
135
136
idePlugins recorder = pluginDescToIdePlugins allPlugins
136
137
where
137
- pluginRecorder :: forall log . (Pretty log ) => Recorder (WithPriority log )
138
- pluginRecorder = cmapWithPrio Log recorder
138
+ pluginRecorder :: forall log . (Pretty log ) => PluginId -> Recorder (WithPriority log )
139
+ pluginRecorder pluginId = cmapWithPrio ( Log pluginId) recorder
139
140
allPlugins =
140
141
#if hls_pragmas
141
142
Pragmas. descriptor " pragmas" :
@@ -144,10 +145,10 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
144
145
Floskell. descriptor " floskell" :
145
146
#endif
146
147
#if hls_fourmolu
147
- Fourmolu. descriptor pluginRecorder " fourmolu " :
148
+ let pId = " fourmolu " in Fourmolu. descriptor ( pluginRecorder pId) pId :
148
149
#endif
149
150
#if hls_tactic
150
- Tactic. descriptor pluginRecorder " tactics " :
151
+ let pId = " tactics " in Tactic. descriptor ( pluginRecorder pId) pId :
151
152
#endif
152
153
#if hls_ormolu
153
154
Ormolu. descriptor " ormolu" :
@@ -156,7 +157,7 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
156
157
StylishHaskell. descriptor " stylish-haskell" :
157
158
#endif
158
159
#if hls_rename
159
- Rename. descriptor pluginRecorder " rename " :
160
+ let pId = " rename " in Rename. descriptor ( pluginRecorder pId) pId :
160
161
#endif
161
162
#if hls_retrie
162
163
Retrie. descriptor " retrie" :
@@ -168,40 +169,40 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
168
169
CallHierarchy. descriptor :
169
170
#endif
170
171
#if hls_class
171
- Class. descriptor pluginRecorder " class " :
172
+ let pId = " class " in Class. descriptor ( pluginRecorder pId) pId :
172
173
#endif
173
174
#if hls_haddockComments
174
- HaddockComments. descriptor pluginRecorder " haddockComments " :
175
+ let pId = " haddockComments " in HaddockComments. descriptor ( pluginRecorder pId) pId :
175
176
#endif
176
177
#if hls_eval
177
- Eval. descriptor pluginRecorder " eval " :
178
+ let pId = " eval " in Eval. descriptor ( pluginRecorder pId) pId :
178
179
#endif
179
180
#if hls_importLens
180
- ExplicitImports. descriptor pluginRecorder " importLens " :
181
+ let pId = " importLens " in ExplicitImports. descriptor ( pluginRecorder pId) pId :
181
182
#endif
182
183
#if hls_qualifyImportedNames
183
184
QualifyImportedNames. descriptor " qualifyImportedNames" :
184
185
#endif
185
186
#if hls_refineImports
186
- RefineImports. descriptor pluginRecorder " refineImports " :
187
+ let pId = " refineImports " in RefineImports. descriptor ( pluginRecorder pId) pId :
187
188
#endif
188
189
#if hls_moduleName
189
- ModuleName. descriptor pluginRecorder " moduleName " :
190
+ let pId = " moduleName " in ModuleName. descriptor ( pluginRecorder pId) pId :
190
191
#endif
191
192
#if hls_hlint
192
- Hlint. descriptor pluginRecorder " hlint " :
193
+ let pId = " hlint " in Hlint. descriptor ( pluginRecorder pId) pId :
193
194
#endif
194
195
#if hls_stan
195
- Stan. descriptor pluginRecorder " stan " :
196
+ let pId = " stan " in Stan. descriptor ( pluginRecorder pId) pId :
196
197
#endif
197
198
#if hls_splice
198
199
Splice. descriptor " splice" :
199
200
#endif
200
201
#if hls_alternateNumberFormat
201
- AlternateNumberFormat. descriptor pluginRecorder :
202
+ let pId = " alternateNumberFormat " in AlternateNumberFormat. descriptor ( pluginRecorder pId) pId :
202
203
#endif
203
204
#if hls_codeRange
204
- CodeRange. descriptor pluginRecorder " codeRange " :
205
+ let pId = " codeRange " in CodeRange. descriptor ( pluginRecorder pId) pId :
205
206
#endif
206
207
#if hls_changeTypeSignature
207
208
ChangeTypeSignature. descriptor :
@@ -210,14 +211,14 @@ idePlugins recorder = pluginDescToIdePlugins allPlugins
210
211
GADT. descriptor " gadt" :
211
212
#endif
212
213
#if hls_refactor
213
- Refactor. iePluginDescriptor pluginRecorder " ghcide-code-actions-imports-exports" :
214
- Refactor. typeSigsPluginDescriptor pluginRecorder " ghcide-code-actions-type-signatures" :
215
- Refactor. bindingsPluginDescriptor pluginRecorder " ghcide-code-actions-bindings" :
216
- Refactor. fillHolePluginDescriptor pluginRecorder " ghcide-code-actions-fill-holes" :
217
- Refactor. extendImportPluginDescriptor pluginRecorder " ghcide-extend-import-action" :
214
+ let pId = " ghcide-code-actions-imports-exports" in Refactor. iePluginDescriptor (pluginRecorder pId) pId :
215
+ let pId = " ghcide-code-actions-type-signatures" in Refactor. typeSigsPluginDescriptor (pluginRecorder pId) pId :
216
+ let pId = " ghcide-code-actions-bindings" in Refactor. bindingsPluginDescriptor (pluginRecorder pId) pId :
217
+ let pId = " ghcide-code-actions-fill-holes" in Refactor. fillHolePluginDescriptor (pluginRecorder pId) pId :
218
+ let pId = " ghcide-extend-import-action" in Refactor. extendImportPluginDescriptor (pluginRecorder pId) pId :
218
219
#endif
219
- GhcIde. descriptors pluginRecorder
220
+ GhcIde. descriptors ( pluginRecorder " ghcide " )
220
221
#if explicitFixity
221
- ++ [ExplicitFixity. descriptor pluginRecorder]
222
+ ++ [let pId = " explicit-fixity " in ExplicitFixity. descriptor ( pluginRecorder pId) pId ]
222
223
#endif
223
224
0 commit comments