File tree 1 file changed +7
-4
lines changed
ghcide/src/Development/IDE/LSP 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -195,11 +195,18 @@ handleInit recorder getHieDbLoc getIdeState lifetime exitClientMsg clearReqId wa
195
195
let root = LSP. resRootPath env
196
196
dir <- maybe getCurrentDirectory return root
197
197
dbLoc <- getHieDbLoc dir
198
+
199
+ -- The database needs to be open for the duration of the reactor thread, but we need to pass in a reference
200
+ -- to 'getIdeState', so we use this dirty trick
198
201
dbMVar <- newEmptyMVar
202
+ ~ (WithHieDbShield withHieDb,hieChan) <- unsafeInterleaveIO $ takeMVar dbMVar
203
+
204
+ ide <- getIdeState env root withHieDb hieChan
199
205
200
206
let initConfig = parseConfiguration params
201
207
202
208
logWith recorder Info $ LogRegisteringIdeConfig initConfig
209
+ registerIdeConfiguration (shakeExtras ide) initConfig
203
210
204
211
let handleServerException (Left e) = do
205
212
logWith recorder Error $ LogReactorThreadException e
@@ -236,10 +243,6 @@ handleInit recorder getHieDbLoc getIdeState lifetime exitClientMsg clearReqId wa
236
243
ReactorNotification act -> handle exceptionInHandler act
237
244
ReactorRequest _id act k -> void $ async $ checkCancelled _id act k
238
245
logWith recorder Info LogReactorThreadStopped
239
-
240
- (WithHieDbShield withHieDb,hieChan) <- takeMVar dbMVar
241
- ide <- getIdeState env root withHieDb hieChan
242
- registerIdeConfiguration (shakeExtras ide) initConfig
243
246
pure $ Right (env,ide)
244
247
245
248
You can’t perform that action at this time.
0 commit comments