From: Luke Lau Date: Tue, 14 Aug 2018 21:15:09 +0000 (+0100) Subject: Squashed commit of the following: X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=commitdiff_plain;h=5732d9891b7515251ba3fd66269c21d63ed12c79 Squashed commit of the following: commit d356140fee78fb2ef8efcf50805280c53cb3232b Author: Luke Lau Date: Wed Aug 8 16:02:45 2018 +0100 Pick correct stack.yaml commit 98ea7eeeffa2045e6564498df6d95965b405b4ef Author: Luke Lau Date: Wed Aug 8 13:34:51 2018 +0100 Limit number of jobs for stack commit 6a7ebc0d46c8d66adbf69f3bb0d26973ce11879c Author: Luke Lau Date: Wed Aug 8 11:40:10 2018 +0100 Use stack hoogle commit b0e4c4b015fc173519f3019503d172803aad246a Author: Luke Lau Date: Wed Aug 8 11:37:46 2018 +0100 Update submodules commit aab5f2a37290fcf7e85fabc828e3379317bf8221 Author: Luke Lau Date: Wed Aug 8 11:29:22 2018 +0100 Fix git pull commit b0a1cb90d07b0bbf120a99d0427e98dca04d4bde Author: Luke Lau Date: Wed Aug 8 11:23:27 2018 +0100 Use stack again for hie commit d8140e8547dfefcdc06c5c5870c4d0b7f9a4ec94 Author: Luke Lau Date: Wed Aug 8 11:04:30 2018 +0100 See if hie is installed correctly commit 3657f4643067ae95b11b83f9457eacd782a79133 Author: Luke Lau Date: Tue Aug 7 19:48:37 2018 +0100 Kill process even if exception is thrown commit 6ff0c8ba66e02efd3b69ccf83772b1e80ea17b19 Author: Luke Lau Date: Tue Aug 7 16:33:58 2018 +0100 Set permissions of hie commit 8ef3b3e290cc2601f939feae14a99100a7bf7b3c Author: Luke Lau Date: Tue Aug 7 16:12:19 2018 +0100 Cache dist dist-newstyle commit aea35bb55dbc3a1791bbe5cc39d8d16fd35aaddd Author: Luke Lau Date: Tue Aug 7 15:36:00 2018 +0100 Fix stupid typo commit e7b69115e8be01d9eecac37d35e4f17f584abb5d Author: Luke Lau Date: Tue Aug 7 15:28:06 2018 +0100 Remove redundant build step commit 36d977fb0b9b368c477b0d8c8fdc59059849dc53 Author: Luke Lau Date: Tue Aug 7 15:25:34 2018 +0100 Try out a wee download hie script commit 69a057e422fb7c1dfa88738f523d972003778c7b Author: Luke Lau Date: Tue Aug 7 15:07:31 2018 +0100 Explore env vars commit e7ca115d7979c3152eaa749a86d44abe7abbef34 Author: Luke Lau Date: Tue Aug 7 14:54:34 2018 +0100 Try circleCI binary commit 382d85457ae4208b79631eeed83bd3c7dfddd2f8 Author: Luke Lau Date: Tue Aug 7 13:25:34 2018 +0100 Try hoogle from apt commit 01a5d2a0cc41f2320cee90a06a007fac93e69b7d Author: Luke Lau Date: Tue Aug 7 12:12:58 2018 +0100 Install happy commit 59b1252ff7e931d1e3050d3cd6329b3bc196d43e Author: Luke Lau Date: Tue Aug 7 11:20:10 2018 +0100 Export path instead of copying commit 19c449d987527f5fe601a15826cc124082549660 Author: Luke Lau Date: Tue Aug 7 10:41:39 2018 +0100 Move cabal install path commit 4b363ee527121d080478c5614cd7ba9ef1804d3d Author: Luke Lau Date: Tue Aug 7 10:24:22 2018 +0100 Add code coverage commit c717c6940046723ea2f0b339d2edd800cabe1c9a Author: Luke Lau Date: Tue Aug 7 10:05:15 2018 +0100 Limit concurrent jobs to 2 commit 49e886730625d5a0707a36afcb139beb39c0c47d Author: Luke Lau Date: Tue Aug 7 01:30:36 2018 +0100 Remove cabal update commit 36a697113f3b8c2d620e703e4c4bef593e1bb37d Author: Luke Lau Date: Tue Aug 7 01:25:26 2018 +0100 mkdir -p hie dir commit f7b62fb37e3b7439360ea70ace0f7ccf1a2c9c74 Author: Luke Lau Date: Tue Aug 7 01:18:41 2018 +0100 Try out cabal tests --- diff --git a/.gitignore b/.gitignore index 21a6195..b057681 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ example/.ghc.environment.* # used for rerunning failed hspec tests .hspec-failures + +# downloaded by .download-hie.sh on travis +hie diff --git a/.travis.yml b/.travis.yml index 25a5e69..d2cfa2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,15 @@ -# language: haskell -# ghc: -# - "8.2.2" -# - "8.4.2" -language: c +language: haskell +ghc: + - "8.2.2" + - "8.4.3" sudo: false # Caching so the next build will be fast too. cache: directories: + - dist + - dist-newstyle - $HOME/.stack - $HOME/haskell-ide-engine/.stack-work @@ -18,31 +19,36 @@ addons: - npm before_install: - # Download and unpack the stack executable + - printenv - mkdir -p ~/.local/bin - export PATH=$HOME/.local/bin:$PATH - travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' - - - cd $HOME - # It's ok to fail - - cd haskell-ide-engine + - stack config set system-ghc --global true + # - export PATH=/opt/ghc/8.4.3/bin:$PATH + # - sh .download-hie.sh + # - export PATH=$TRAVIS_BUILD_DIR:$PATH + # - hie version + - mkdir -p haskell-ide-engine + - cd $HOME/haskell-ide-engine - git init - - git remote add origin https://github.com/Bubba/haskell-ide-engine.git - - git pull origin heirarchal-document-symbols + - git remote add origin https://github.com/haskell/haskell-ide-engine.git + - git pull origin master - git submodule init - git submodule sync - - git submodule update - # - cabal new-update - # - cabal new-configure - # - cabal new-build - # - export PATH=$HOME/haskell-ide-engine/dist-newstyle/build/*/ghc-*/haskell-ide-engine-*/x/hie/build:$PATH - - stack --no-terminal --skip-ghc-check install -j2 + - git submodule update --init + - stack --no-terminal --skip-ghc-check -j2 install --stack-yaml=stack-$TRAVIS_HASKELL_VERSION.yaml - stack exec hoogle generate - cd $TRAVIS_BUILD_DIR + - hie --version + # - git submodule init + # - git submodule sync + # - git submodule update + # - cabal new-configure + # - cabal new-build -j2 + # - export PATH=$HOME/haskell-ide-engine/dist-newstyle/build/*/ghc-*/haskell-ide-engine-*/c/hie/build/hie/hie:$PATH - npm update - npm i -g javascript-typescript-langserver script: - - stack test - # - cabal configure --enable-tests - # - cabal test -j2 --show-details=streaming + - cabal configure --enable-tests + - cabal test --show-details=streaming diff --git a/lsp-test.cabal b/lsp-test.cabal index 9c422d4..b191b6c 100644 --- a/lsp-test.cabal +++ b/lsp-test.cabal @@ -78,9 +78,9 @@ test-suite tests build-depends: base >= 4.7 && < 5 , hspec , lens - , data-default - , haskell-lsp >= 0.6 + , haskell-lsp , lsp-test + , data-default , aeson , unordered-containers , text diff --git a/src/Language/Haskell/LSP/Test/Server.hs b/src/Language/Haskell/LSP/Test/Server.hs index 7d00f23..bd5bdb9 100644 --- a/src/Language/Haskell/LSP/Test/Server.hs +++ b/src/Language/Haskell/LSP/Test/Server.hs @@ -1,6 +1,7 @@ module Language.Haskell.LSP.Test.Server (withServer) where import Control.Concurrent +import Control.Exception import Control.Monad import Language.Haskell.LSP.Test.Compat import System.IO @@ -21,8 +22,6 @@ withServer serverExe logStdErr f = do pid <- getProcessID serverProc - result <- f serverIn serverOut pid - + finally (f serverIn serverOut pid) $ do killThread errSinkThread terminateProcess serverProc - return result diff --git a/test/data/renamePass/session.log b/test/data/renamePass/session.log index 08ee037..e03f29c 100644 --- a/test/data/renamePass/session.log +++ b/test/data/renamePass/session.log @@ -9,7 +9,7 @@ {"tag":"FromServer","contents":["2018-06-03T04:08:39.524239Z",{"tag":"NotPublishDiagnostics","contents":{"jsonrpc":"2.0","params":{"uri":"file:///Users/luke/Desktop/simple.hs","diagnostics":[]},"method":"textDocument/publishDiagnostics"}}]} {"tag":"FromServer","contents":["2018-06-03T04:08:39.714012Z",{"tag":"NotPublishDiagnostics","contents":{"jsonrpc":"2.0","params":{"uri":"file:///Users/luke/Desktop/simple.hs","diagnostics":[]},"method":"textDocument/publishDiagnostics"}}]} {"tag":"FromClient","contents":["2018-06-03T04:08:40.844374Z",{"tag":"ReqDocumentSymbols","contents":{"jsonrpc":"2.0","params":{"textDocument":{"uri":"file:///Users/luke/Desktop/simple.hs"}},"method":"textDocument/documentSymbol","id":25}}]} -{"tag":"FromServer","contents":["2018-06-03T04:08:40.859268Z",{"tag":"RspDocumentSymbols","contents":{"result":[{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":3,"character":0},"end":{"line":3,"character":4}}},"kind":12,"name":"main"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":7,"character":5},"end":{"line":7,"character":9}}},"kind":5,"name":"Item"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":8,"character":5},"end":{"line":8,"character":10}}},"kind":5,"name":"Items"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":10,"character":5},"end":{"line":10,"character":12}}},"kind":5,"name":"Command"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":10,"character":15},"end":{"line":10,"character":19}}},"kind":9,"containerName":"Command","name":"Quit"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":11,"character":15},"end":{"line":11,"character":27}}},"kind":9,"containerName":"Command","name":"DisplayItems"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":12,"character":15},"end":{"line":12,"character":22}}},"kind":9,"containerName":"Command","name":"AddItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":13,"character":15},"end":{"line":13,"character":25}}},"kind":9,"containerName":"Command","name":"RemoveItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":14,"character":15},"end":{"line":14,"character":19}}},"kind":9,"containerName":"Command","name":"Help"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":16,"character":5},"end":{"line":16,"character":10}}},"kind":5,"name":"Error"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":19,"character":0},"end":{"line":19,"character":12}}},"kind":12,"name":"parseCommand"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":28,"character":0},"end":{"line":28,"character":7}}},"kind":12,"name":"addItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":31,"character":0},"end":{"line":31,"character":12}}},"kind":12,"name":"displayItems"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":34,"character":0},"end":{"line":34,"character":10}}},"kind":12,"name":"removeItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":37,"character":9},"end":{"line":37,"character":14}}},"kind":6,"containerName":"removeItem","name":"front"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":37,"character":16},"end":{"line":37,"character":20}}},"kind":6,"containerName":"removeItem","name":"back"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":38,"character":8},"end":{"line":38,"character":14}}},"kind":12,"containerName":"removeItem","name":"result"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":41,"character":0},"end":{"line":41,"character":16}}},"kind":12,"name":"interactWithUser"}],"jsonrpc":"2.0","id":25}}]} +{"tag":"FromServer","contents":["2018-06-03T04:08:40.859268Z",{"tag":"RspDocumentSymbols","contents":{"result":[{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":3,"character":0},"end":{"line":3,"character":4}}},"kind":12,"name":"main"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":7,"character":5},"end":{"line":7,"character":9}}},"kind":5,"name":"Item"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":8,"character":5},"end":{"line":8,"character":10}}},"kind":5,"name":"Items"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":10,"character":5},"end":{"line":10,"character":12}}},"kind":5,"name":"Command"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":10,"character":15},"end":{"line":10,"character":19}}},"kind":9,"containerName":"Command","name":"Quit"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":11,"character":15},"end":{"line":11,"character":27}}},"kind":9,"containerName":"Command","name":"DisplayItems"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":12,"character":15},"end":{"line":12,"character":22}}},"kind":9,"containerName":"Command","name":"AddItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":13,"character":15},"end":{"line":13,"character":25}}},"kind":9,"containerName":"Command","name":"RemoveItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":14,"character":15},"end":{"line":14,"character":19}}},"kind":9,"containerName":"Command","name":"Help"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":16,"character":5},"end":{"line":16,"character":10}}},"kind":5,"name":"Error"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":19,"character":0},"end":{"line":19,"character":12}}},"kind":12,"name":"parseCommand"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":28,"character":0},"end":{"line":28,"character":7}}},"kind":12,"name":"addItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":31,"character":0},"end":{"line":31,"character":12}}},"kind":12,"name":"displayItems"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":34,"character":0},"end":{"line":34,"character":10}}},"kind":12,"name":"removeItem"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":37,"character":9},"end":{"line":37,"character":14}}},"kind":13,"containerName":"removeItem","name":"front"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":37,"character":16},"end":{"line":37,"character":20}}},"kind":13,"containerName":"removeItem","name":"back"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":38,"character":8},"end":{"line":38,"character":14}}},"kind":12,"containerName":"removeItem","name":"result"},{"location":{"uri":"file:///Users/luke/Desktop/simple.hs","range":{"start":{"line":41,"character":0},"end":{"line":41,"character":16}}},"kind":12,"name":"interactWithUser"}],"jsonrpc":"2.0","id":25}}]} {"tag":"FromClient","contents":["2018-06-03T04:08:46.24927Z",{"tag":"ReqRename","contents":{"jsonrpc":"2.0","params":{"newName":"arseCommand","textDocument":{"uri":"file:///Users/luke/Desktop/simple.hs"},"position":{"line":19,"character":0}},"method":"textDocument/rename","id":32}}]} {"tag":"FromServer","contents":["2018-06-03T04:08:46.528715Z",{"tag":"RspRename","contents":{"result":{"changes":{"file:///Users/luke/Desktop/simple.hs":[{"range":{"start":{"line":43,"character":0},"end":{"line":43,"character":27}},"newText":" case arseCommand line of"},{"range":{"start":{"line":18,"character":0},"end":{"line":19,"character":38}},"newText":"arseCommand :: String -> Either Error Command\narseCommand line = case words line of"}]}},"jsonrpc":"2.0","id":32}}]} {"tag":"FromClient","contents":["2018-06-03T04:08:48.300837Z",{"tag":"NotDidChangeTextDocument","contents":{"jsonrpc":"2.0","params":{"contentChanges":[{"text":"module Main where\n\nmain :: IO ()\nmain = do\n let initialList = []\n interactWithUser initialList\n\ntype Item = String\ntype Items = [Item]\n\ndata Command = Quit\n | DisplayItems\n | AddItem String\n | RemoveItem Int\n | Help\n\ntype Error = String\n\narseCommand :: String -> Either Error Command\narseCommand line = case words line of\n [\"quit\"] -> Right Quit\n [\"items\"] -> Right DisplayItems\n \"add\" : item -> Right $ AddItem $ unwords item\n \"remove\" : i -> Right $ RemoveItem $ read $ unwords i\n [\"help\"] -> Right Help\n _ -> Left \"Unknown command\"\n\naddItem :: Item -> Items -> Items\naddItem = (:)\n\ndisplayItems :: Items -> String\ndisplayItems = unlines . map (\"- \" ++)\n\nremoveItem :: Int -> Items -> Either Error Items\nremoveItem i items\n | i < 0 || i >= length items = Left \"Out of range\"\n | otherwise = Right result\n where (front, back) = splitAt (i + 1) items\n result = init front ++ back\n\ninteractWithUser :: Items -> IO ()\ninteractWithUser items = do\n line <- getLine\n case arseCommand line of\n Right DisplayItems -> do\n putStrLn $ displayItems items\n interactWithUser items\n\n Right (AddItem item) -> do\n let newItems = addItem item items\n putStrLn \"Added\"\n interactWithUser newItems\n\n Right (RemoveItem i) ->\n case removeItem i items of\n Right newItems -> do\n putStrLn $ \"Removed \" ++ items !! i\n interactWithUser newItems\n Left err -> do\n putStrLn err\n interactWithUser items\n\n\n Right Quit -> return ()\n\n Right Help -> do\n putStrLn \"Commands:\"\n putStrLn \"help\"\n putStrLn \"items\"\n putStrLn \"add\"\n putStrLn \"quit\"\n interactWithUser items\n\n Left err -> do\n putStrLn $ \"Error: \" ++ err\n interactWithUser items\n"}],"textDocument":{"uri":"file:///Users/luke/Desktop/simple.hs","version":1}},"method":"textDocument/didChange"}}]}