@@ -119,7 +119,11 @@ data PluginDescriptor (ideState :: *) =
119
119
, pluginNotificationHandlers :: PluginNotificationHandlers ideState
120
120
, pluginModifyDynflags :: DynFlagsModifications
121
121
, pluginCli :: Maybe (ParserInfo (IdeCommand ideState ))
122
- , pluginFileType :: [T. Text ]
122
+ , pluginFileType :: [T. Text ]
123
+ -- ^ File extension of the files the plugin is responsible for.
124
+ -- The plugin is only allowed to handle files with these extensions
125
+ -- When writing handlers, etc. for this plugin it can be assumed that all handled files are of this type.
126
+ -- The file extension must have a leading '.'.
123
127
}
124
128
125
129
-- | An existential wrapper of 'Properties'
@@ -165,7 +169,13 @@ defaultConfigDescriptor = ConfigDescriptor True False (mkCustomConfig emptyPrope
165
169
class HasTracing (MessageParams m ) => PluginMethod (k :: MethodType ) (m :: Method FromClient k ) where
166
170
167
171
-- | Parse the configuration to check if this plugin is enabled
168
- pluginEnabled :: SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> Bool
172
+ pluginEnabled
173
+ :: SMethod m
174
+ -> MessageParams m
175
+ -- ^
176
+ -> PluginDescriptor c
177
+ -> Config
178
+ -> Bool
169
179
170
180
default pluginEnabled :: (HasTextDocument (MessageParams m ) doc , HasUri doc Uri )
171
181
=> SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> Bool
@@ -220,6 +230,9 @@ instance PluginRequestMethod TextDocumentCodeAction where
220
230
, Just caKind <- ca ^. kind = any (\ k -> k `codeActionKindSubsumes` caKind) allowed
221
231
| otherwise = False
222
232
233
+ -- | Check whether the given plugin descriptor is responsible for the file with the given path.
234
+ -- Compares the file extension of the file at the given path with the file extension
235
+ -- the plugin is responsible for.
223
236
pluginResponsible :: Uri -> PluginDescriptor c -> Bool
224
237
pluginResponsible uri pluginDesc
225
238
| Just fp <- mfp
0 commit comments