+ describe "file watching" $
+ it "works" $ do
+ tmp <- liftIO getTemporaryDirectory
+ let testFile = tmp </> "lsp-test.watch"
+ testFile' = tmp </> "lsp-test.nowatch"
+ finally (runSession serverExe fullCaps "" $ do
+ loggingNotification -- initialized log message
+
+ createDoc ".register.tmp" "haskell" ""
+ message :: Session RegisterCapabilityRequest
+
+ liftIO $ writeFile testFile "Hello" -- >> hFlush h
+ NotLogMessage msg <- loggingNotification
+ liftIO $ msg ^. params . LSP.message `shouldBe` "got workspace/didChangeWatchedFiles"
+
+ -- this shouldn't trigger a watch files thingy
+ liftIO $ writeFile testFile' "Hello"
+ doc <- createDoc "blah" "haskell" ""
+
+ let testNoLog = do
+ void $ sendRequest TextDocumentHover $
+ TextDocumentPositionParams doc (Position 0 0) Nothing
+ count 0 $ loggingNotification
+ void $ anyResponse
+ testNoLog
+
+ -- unwatch .watch in tmp
+ createDoc ".unregister.tmp" "haskell" ""
+ message :: Session UnregisterCapabilityRequest
+
+ -- modifying shouldn't return anything
+ liftIO $ writeFile testFile "Hello"
+ testNoLog) (mapM_ removeFile [testFile, testFile'])
+