@@ -119,7 +119,11 @@ data PluginDescriptor (ideState :: *) =
119119 , pluginNotificationHandlers :: PluginNotificationHandlers ideState
120120 , pluginModifyDynflags :: DynFlagsModifications
121121 , 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 '.'.
123127 }
124128
125129-- | An existential wrapper of 'Properties'
@@ -165,7 +169,13 @@ defaultConfigDescriptor = ConfigDescriptor True False (mkCustomConfig emptyPrope
165169class HasTracing (MessageParams m ) => PluginMethod (k :: MethodType ) (m :: Method FromClient k ) where
166170
167171 -- | 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
169179
170180 default pluginEnabled :: (HasTextDocument (MessageParams m ) doc , HasUri doc Uri )
171181 => SMethod m -> MessageParams m -> PluginDescriptor c -> Config -> Bool
@@ -220,6 +230,9 @@ instance PluginRequestMethod TextDocumentCodeAction where
220230 , Just caKind <- ca ^. kind = any (\ k -> k `codeActionKindSubsumes` caKind) allowed
221231 | otherwise = False
222232
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.
223236pluginResponsible :: Uri -> PluginDescriptor c -> Bool
224237pluginResponsible uri pluginDesc
225238 | Just fp <- mfp
0 commit comments