mirror of
https://github.com/haskell/ghcide.git
synced 2024-12-13 18:23:38 +03:00
Change the IDE demo to use runLanguageServer (#1655)
This commit is contained in:
parent
795f7b20bb
commit
9a3fa3fe8b
32
test/Demo.hs
32
test/Demo.hs
@ -39,13 +39,9 @@ main = do
|
|||||||
|
|
||||||
-- lock to avoid overlapping output on stdout
|
-- lock to avoid overlapping output on stdout
|
||||||
lock <- newLock
|
lock <- newLock
|
||||||
|
let logger = makeOneHandle $ withLock lock . T.putStrLn
|
||||||
|
|
||||||
vfs <- makeVFSHandle
|
let options = IdeOptions
|
||||||
ide <- initialise
|
|
||||||
mainRule
|
|
||||||
(showEvent lock)
|
|
||||||
(makeOneHandle $ withLock lock . T.putStrLn)
|
|
||||||
IdeOptions
|
|
||||||
{optPreprocessor = (,) []
|
{optPreprocessor = (,) []
|
||||||
,optWriteIface = False
|
,optWriteIface = False
|
||||||
,optGhcSession = liftIO $ newSession ghcOptions
|
,optGhcSession = liftIO $ newSession ghcOptions
|
||||||
@ -54,13 +50,23 @@ main = do
|
|||||||
,optThreads = 0
|
,optThreads = 0
|
||||||
,optShakeProfiling = Nothing -- Just "output.html"
|
,optShakeProfiling = Nothing -- Just "output.html"
|
||||||
}
|
}
|
||||||
vfs
|
|
||||||
setFilesOfInterest ide $ Set.fromList files
|
if null files then
|
||||||
_ <- runAction ide $ uses_ TypeCheck files
|
runLanguageServer logger $ \event vfs ->
|
||||||
-- shake now writes an async message that it is completed with timing info,
|
initialise mainRule event logger options vfs
|
||||||
-- so we sleep briefly to wait for it to have been written
|
else do
|
||||||
sleep 0.01
|
vfs <- makeVFSHandle
|
||||||
putStrLn "Done"
|
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.
|
-- | Print an LSP event.
|
||||||
|
Loading…
Reference in New Issue
Block a user