Skip to content

Commit

Permalink
defaultPluginDescripor - take PluginId as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeiborra committed May 23, 2020
1 parent d51c279 commit 1a46b0b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 24 deletions.
5 changes: 2 additions & 3 deletions src/Ide/Plugin/Brittany.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import System.FilePath
import Data.Maybe (maybeToList)

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginFormattingProvider = Just provider
descriptor plId = (defaultPluginDescriptor plId)
{ pluginFormattingProvider = Just provider
}

-- | Formatter provider of Brittany.
Expand Down
5 changes: 2 additions & 3 deletions src/Ide/Plugin/Example.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ import Text.Regex.TDFA.Text()
-- ---------------------------------------------------------------------

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginRules = exampleRules
descriptor plId = (defaultPluginDescriptor plId)
{ pluginRules = exampleRules
, pluginCommands = [PluginCommand "codelens.todo" "example adding" addTodoCmd]
, pluginCodeActionProvider = Just codeAction
, pluginCodeLensProvider = Just codeLens
Expand Down
5 changes: 2 additions & 3 deletions src/Ide/Plugin/Example2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ import Text.Regex.TDFA.Text()
-- ---------------------------------------------------------------------

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginRules = exampleRules
descriptor plId = (defaultPluginDescriptor plId)
{ pluginRules = exampleRules
, pluginCommands = [PluginCommand "codelens.todo" "example adding" addTodoCmd]
, pluginCodeActionProvider = Just codeAction
, pluginCodeLensProvider = Just codeLens
Expand Down
5 changes: 2 additions & 3 deletions src/Ide/Plugin/Floskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ import Text.Regex.TDFA.Text()
-- ---------------------------------------------------------------------

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginFormattingProvider = Just provider
descriptor plId = (defaultPluginDescriptor plId)
{ pluginFormattingProvider = Just provider
}

-- ---------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions src/Ide/Plugin/GhcIde.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import Text.Regex.TDFA.Text()
-- ---------------------------------------------------------------------

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginCommands = [PluginCommand (CommandId "typesignature.add") "adds a signature" commandAddSignature]
descriptor plId = (defaultPluginDescriptor plId)
{ pluginCommands = [PluginCommand (CommandId "typesignature.add") "adds a signature" commandAddSignature]
, pluginCodeActionProvider = Just codeAction'
, pluginCodeLensProvider = Just codeLens'
, pluginHoverProvider = Just hover'
Expand Down
5 changes: 2 additions & 3 deletions src/Ide/Plugin/Ormolu.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import Text.Regex.TDFA.Text()
-- ---------------------------------------------------------------------

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginFormattingProvider = Just provider
descriptor plId = (defaultPluginDescriptor plId)
{ pluginFormattingProvider = Just provider
}

-- ---------------------------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions src/Ide/Plugin/Pragmas.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ import Language.Haskell.LSP.Types
-- ---------------------------------------------------------------------

descriptor :: PluginId -> PluginDescriptor
descriptor plId = defaultPluginDescriptor
{ pluginId = plId
, pluginCommands = commands
descriptor plId = (defaultPluginDescriptor plId)
{ pluginCommands = commands
, pluginCodeActionProvider = Just codeActionProvider
}

Expand Down
6 changes: 3 additions & 3 deletions src/Ide/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ data PluginDescriptor =
, pluginRenameProvider :: !(Maybe RenameProvider)
}

defaultPluginDescriptor :: PluginDescriptor
defaultPluginDescriptor =
defaultPluginDescriptor :: PluginId -> PluginDescriptor
defaultPluginDescriptor plId =
PluginDescriptor
""
plId
mempty
mempty
Nothing
Expand Down

0 comments on commit 1a46b0b

Please sign in to comment.