@@ -28,8 +28,6 @@ import Development.IDE.Types.Diagnostics
2828import Development.IDE.Types.Options
2929import Development.IDE.Types.Logger
3030import Development.IDE.Plugin
31- import Development.IDE.Plugin.Completions as Completions
32- import Development.IDE.Plugin.CodeAction as CodeAction
3331import Development.IDE.Plugin.Test as Test
3432import Development.IDE.Session (loadSession )
3533import qualified Language.Haskell.LSP.Core as LSP
@@ -54,6 +52,10 @@ import Development.IDE (action)
5452import Text.Printf
5553import Development.IDE.Core.Tracing
5654import Development.IDE.Types.Shake (Key (Key ))
55+ import Development.IDE.Plugin.HLS (asGhcIdePlugin )
56+ import Development.IDE.Plugin.HLS.GhcIde as GhcIde
57+ import Ide.Plugin.Config
58+ import Ide.PluginUtils (allLspCmdIds' , getProcessID , pluginDescToIdePlugins )
5759
5860ghcideVersion :: IO String
5961ghcideVersion = do
@@ -83,18 +85,23 @@ main = do
8385 whenJust argsCwd IO. setCurrentDirectory
8486
8587 dir <- IO. getCurrentDirectory
86- command <- makeLspCommandId " typesignature.add"
8788
88- let plugins = Completions. plugin <> CodeAction. plugin
89+ let hlsPlugins = pluginDescToIdePlugins [GhcIde. descriptor " ghcide" ]
90+
91+ pid <- T. pack . show <$> getProcessID
92+ let hlsPlugin = asGhcIdePlugin hlsPlugins
93+ hlsCommands = allLspCmdIds' pid hlsPlugins
94+
95+ let plugins = hlsPlugin
8996 <> if argsTesting then Test. plugin else mempty
90- onInitialConfiguration :: InitializeRequest -> Either T. Text LspConfig
97+ onInitialConfiguration :: InitializeRequest -> Either T. Text Config
9198 onInitialConfiguration x = case x ^. params . initializationOptions of
92- Nothing -> Right defaultLspConfig
99+ Nothing -> Right def
93100 Just v -> case J. fromJSON v of
94101 J. Error err -> Left $ T. pack err
95102 J. Success a -> Right a
96103 onConfigurationChange = const $ Left " Updating Not supported"
97- options = def { LSP. executeCommandCommands = Just [command]
104+ options = def { LSP. executeCommandCommands = Just hlsCommands
98105 , LSP. completionTriggerCharacters = Just " ."
99106 }
100107
@@ -106,7 +113,7 @@ main = do
106113 t <- t
107114 hPutStrLn stderr $ " Started LSP server in " ++ showDuration t
108115 sessionLoader <- loadSession $ fromMaybe dir rootPath
109- config <- fromMaybe defaultLspConfig <$> getConfig
116+ config <- fromMaybe def <$> getConfig
110117 let options = (defaultIdeOptions sessionLoader)
111118 { optReportProgress = clientSupportsProgress caps
112119 , optShakeProfiling = argsShakeProfiling
@@ -159,7 +166,7 @@ main = do
159166 , optTesting = IdeTesting argsTesting
160167 , optThreads = argsThreads
161168 , optCheckParents = NeverCheck
162- , optCheckProject = CheckProject False
169+ , optCheckProject = False
163170 }
164171 logLevel = if argsVerbose then minBound else Info
165172 ide <- initialise def mainRule (pure $ IdInt 0 ) (showEvent lock) dummyWithProg (const (const id )) (logger logLevel) debouncer options vfs
0 commit comments