on master help sign in
Change the IDE demo to use runLanguageServer (#1655)
commit9a3fa3fe8bc62cb7600accdddccf33c82c75c2aa authorNeil Mitchell <35463327+neil-da@users.noreply.github.com> dateThu 13 Jun 2019, 18:21 (7 years ago) parent795f7b2
1 file changed+19−13
test/Demo.hs+19−13
test/Demo.hs+19−13
@@ -39,13 +39,9 @@ main = do
3939
4040 -- lock to avoid overlapping output on stdout
4141 lock <- newLock
42+ let logger = makeOneHandle $ withLock lock . T.putStrLn
4243
43− vfs <- makeVFSHandle
44− ide <- initialise
45− mainRule
46− (showEvent lock)
47− (makeOneHandle $ withLock lock . T.putStrLn)
48− IdeOptions
44+ let options = IdeOptions
4945 {optPreprocessor = (,) []
5046 ,optWriteIface = False
5147 ,optGhcSession = liftIO $ newSession ghcOptions
@@ -54,13 +50,23 @@ main = do
5450 ,optThreads = 0
5551 ,optShakeProfiling = Nothing -- Just "output.html"
5652 }
57− vfs
58− setFilesOfInterest ide $ Set.fromList files
59− _ <- runAction ide $ uses_ TypeCheck files
60− -- shake now writes an async message that it is completed with timing info,
61− -- so we sleep briefly to wait for it to have been written
62− sleep 0.01
63− putStrLn "Done"
53+
54+ if null files then
55+ runLanguageServer logger $ \event vfs ->
56+ initialise mainRule event logger options vfs
57+ else do
58+ vfs <- makeVFSHandle
59+ ide <- initialise mainRule (showEvent lock) logger options vfs
60+ setFilesOfInterest ide $ Set.fromList files
61+ _ <- runAction ide $ uses_ TypeCheck files
62+ -- shake now writes an async message that it is completed with timing info,
63+ -- so we sleep briefly to wait for it to have been written
64+ sleep 0.01
65+ putStrLn "Done"
66+
67+
68+runLanguageServer :: a
69+runLanguageServer = undefined
6470
6571
6672-- | Print an LSP event.