Change the IDE demo to use runLanguageServer (#1655)

This commit is contained in:
Neil Mitchell 2019-06-13 18:21:27 +02:00 committed by GitHub
parent 795f7b20bb
commit 9a3fa3fe8b

View File

@ -39,13 +39,9 @@ main = do
-- lock to avoid overlapping output on stdout
lock <- newLock
let logger = makeOneHandle $ withLock lock . T.putStrLn
vfs <- makeVFSHandle
ide <- initialise
mainRule
(showEvent lock)
(makeOneHandle $ withLock lock . T.putStrLn)
IdeOptions
let options = IdeOptions
{optPreprocessor = (,) []
,optWriteIface = False
,optGhcSession = liftIO $ newSession ghcOptions
@ -54,13 +50,23 @@ main = do
,optThreads = 0
,optShakeProfiling = Nothing -- Just "output.html"
}
vfs
setFilesOfInterest ide $ Set.fromList files
_ <- runAction ide $ uses_ TypeCheck files
-- shake now writes an async message that it is completed with timing info,
-- so we sleep briefly to wait for it to have been written
sleep 0.01
putStrLn "Done"
if null files then
runLanguageServer logger $ \event vfs ->
initialise mainRule event logger options vfs
else do
vfs <- makeVFSHandle
ide <- initialise mainRule (showEvent lock) logger options vfs
setFilesOfInterest ide $ Set.fromList files
_ <- runAction ide $ uses_ TypeCheck files
-- shake now writes an async message that it is completed with timing info,
-- so we sleep briefly to wait for it to have been written
sleep 0.01
putStrLn "Done"
runLanguageServer :: a
runLanguageServer = undefined
-- | Print an LSP event.