@@ -28,8 +28,6 @@ import Development.IDE.Types.Diagnostics
28
28
import Development.IDE.Types.Options
29
29
import Development.IDE.Types.Logger
30
30
import Development.IDE.Plugin
31
- import Development.IDE.Plugin.Completions as Completions
32
- import Development.IDE.Plugin.CodeAction as CodeAction
33
31
import Development.IDE.Plugin.Test as Test
34
32
import Development.IDE.Session (loadSession )
35
33
import qualified Language.Haskell.LSP.Core as LSP
@@ -54,6 +52,10 @@ import Development.IDE (action)
54
52
import Text.Printf
55
53
import Development.IDE.Core.Tracing
56
54
import 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 )
57
59
58
60
ghcideVersion :: IO String
59
61
ghcideVersion = do
@@ -83,18 +85,23 @@ main = do
83
85
whenJust argsCwd IO. setCurrentDirectory
84
86
85
87
dir <- IO. getCurrentDirectory
86
- command <- makeLspCommandId " typesignature.add"
87
88
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
89
96
<> if argsTesting then Test. plugin else mempty
90
- onInitialConfiguration :: InitializeRequest -> Either T. Text LspConfig
97
+ onInitialConfiguration :: InitializeRequest -> Either T. Text Config
91
98
onInitialConfiguration x = case x ^. params . initializationOptions of
92
- Nothing -> Right defaultLspConfig
99
+ Nothing -> Right def
93
100
Just v -> case J. fromJSON v of
94
101
J. Error err -> Left $ T. pack err
95
102
J. Success a -> Right a
96
103
onConfigurationChange = const $ Left " Updating Not supported"
97
- options = def { LSP. executeCommandCommands = Just [command]
104
+ options = def { LSP. executeCommandCommands = Just hlsCommands
98
105
, LSP. completionTriggerCharacters = Just " ."
99
106
}
100
107
@@ -106,7 +113,7 @@ main = do
106
113
t <- t
107
114
hPutStrLn stderr $ " Started LSP server in " ++ showDuration t
108
115
sessionLoader <- loadSession $ fromMaybe dir rootPath
109
- config <- fromMaybe defaultLspConfig <$> getConfig
116
+ config <- fromMaybe def <$> getConfig
110
117
let options = (defaultIdeOptions sessionLoader)
111
118
{ optReportProgress = clientSupportsProgress caps
112
119
, optShakeProfiling = argsShakeProfiling
@@ -159,7 +166,7 @@ main = do
159
166
, optTesting = IdeTesting argsTesting
160
167
, optThreads = argsThreads
161
168
, optCheckParents = NeverCheck
162
- , optCheckProject = CheckProject False
169
+ , optCheckProject = False
163
170
}
164
171
logLevel = if argsVerbose then minBound else Info
165
172
ide <- initialise def mainRule (pure $ IdInt 0 ) (showEvent lock) dummyWithProg (const (const id )) (logger logLevel) debouncer options vfs
0 commit comments