mirror of
https://github.com/haskell/haskell-ide-engine.git
synced 2024-09-11 11:05:30 +03:00
Merge remote-tracking branch 'haskell/master' into json-metadata
This commit is contained in:
commit
b4f169c3ba
@ -15,7 +15,9 @@ import qualified Data.Text as T
|
||||
example2Descriptor :: PluginDescriptor
|
||||
example2Descriptor = PluginDescriptor
|
||||
{
|
||||
pdCommands =
|
||||
pdUIShortName = "Hello World"
|
||||
, pdUIOverview = "An example of writing an HIE plugin"
|
||||
, pdCommands =
|
||||
[
|
||||
buildCommand sayHelloCmd "sayHello" "say hello" [] [CtxNone] []
|
||||
, buildCommand sayHelloToCmd "sayHelloTo"
|
||||
|
@ -22,7 +22,11 @@ import System.Directory
|
||||
ghcmodDescriptor :: PluginDescriptor
|
||||
ghcmodDescriptor = PluginDescriptor
|
||||
{
|
||||
pdCommands =
|
||||
pdUIShortName = "ghc-mod"
|
||||
, pdUIOverview = "ghc-mod is a backend program to enrich Haskell programming \
|
||||
\in editors. It strives to offer most of the features one has come to expect \
|
||||
\from modern IDEs in any editor."
|
||||
, pdCommands =
|
||||
[
|
||||
buildCommand checkCmd "check" "check a file for GHC warnings and errors"
|
||||
[".hs",".lhs"] [CtxFile] []
|
||||
|
@ -17,7 +17,12 @@ import System.Directory
|
||||
hareDescriptor :: PluginDescriptor
|
||||
hareDescriptor = PluginDescriptor
|
||||
{
|
||||
pdCommands =
|
||||
pdUIShortName = "HaRe"
|
||||
, pdUIOverview = "A Haskell 2010 refactoring tool. HaRe supports the full \
|
||||
\Haskell 2010 standard, through making use of the GHC API. HaRe attempts to \
|
||||
\operate in a safe way, by first writing new files with proposed changes, and \
|
||||
\only swapping these with the originals when the change is accepted. "
|
||||
, pdCommands =
|
||||
[
|
||||
buildCommand demoteCmd "demote" "Move a definition one level down"
|
||||
[".hs"] [CtxPoint] []
|
||||
|
@ -46,14 +46,18 @@ import GHC.Generics
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
data PluginDescriptor = PluginDescriptor
|
||||
{ pdCommands :: [Command]
|
||||
{ pdUIShortName :: !T.Text
|
||||
, pdUIOverview :: !T.Text
|
||||
, pdCommands :: [Command]
|
||||
, pdExposedServices :: [Service]
|
||||
, pdUsedServices :: [Service]
|
||||
}
|
||||
|
||||
instance Show PluginDescriptor where
|
||||
showsPrec p (PluginDescriptor cmds svcs used) = showParen (p > 10) $
|
||||
showsPrec p (PluginDescriptor name oview cmds svcs used) = showParen (p > 10) $
|
||||
showString "PluginDescriptor " .
|
||||
showString (T.unpack name) .
|
||||
showString (T.unpack oview) .
|
||||
showList cmds .
|
||||
showString " " .
|
||||
showList svcs .
|
||||
|
@ -25,7 +25,9 @@ import Prelude hiding (log)
|
||||
baseDescriptor :: PluginDescriptor
|
||||
baseDescriptor = PluginDescriptor
|
||||
{
|
||||
pdCommands =
|
||||
pdUIShortName = "HIE Base"
|
||||
, pdUIOverview = "Commands for HIE itself, "
|
||||
, pdCommands =
|
||||
[
|
||||
buildCommand versionCmd "version" "return HIE version"
|
||||
[] [CtxNone] []
|
||||
|
@ -83,7 +83,7 @@ pluginCache :: Plugins -> Map.Map (T.Text,T.Text) Command
|
||||
pluginCache plugins = Map.fromList r
|
||||
where
|
||||
doOne :: T.Text -> PluginDescriptor -> [((T.Text,T.Text),Command)]
|
||||
doOne pn (PluginDescriptor cmds _ _) =
|
||||
doOne pn (PluginDescriptor _ _ cmds _ _) =
|
||||
map (\cmd -> ((pn,cmdName (cmdDesc cmd)),cmd)) cmds
|
||||
|
||||
r = concatMap (\(pn,pd) -> doOne pn pd) $ Map.toList plugins
|
||||
|
@ -251,7 +251,9 @@ testPlugins chSync = Map.fromList [("test",testDescriptor chSync)]
|
||||
testDescriptor :: TChan () -> PluginDescriptor
|
||||
testDescriptor chSync = PluginDescriptor
|
||||
{
|
||||
pdCommands =
|
||||
pdUIShortName = "testDescriptor"
|
||||
, pdUIOverview = "PluginDescriptor for testing Dispatcher"
|
||||
, pdCommands =
|
||||
[
|
||||
mkCmdWithContext "cmd1" [CtxNone] []
|
||||
, mkCmdWithContext "cmd2" [CtxFile] []
|
||||
|
@ -95,7 +95,12 @@ instance Arbitrary Service where
|
||||
arbitrary = Service <$> arbitrary
|
||||
|
||||
instance Arbitrary PluginDescriptor where
|
||||
arbitrary = PluginDescriptor <$> smallList arbitrary <*> smallList arbitrary <*> smallList arbitrary
|
||||
arbitrary = PluginDescriptor <$>
|
||||
arbitrary <*>
|
||||
arbitrary <*>
|
||||
smallList arbitrary <*>
|
||||
smallList arbitrary <*>
|
||||
smallList arbitrary
|
||||
|
||||
-- | make lists of maximum length 3 for test performance
|
||||
smallList :: Gen a -> Gen [a]
|
||||
|
Loading…
Reference in New Issue
Block a user