X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest.hs;h=d3b1b65e4c5a7b9c2e9e5190897852e87a2ec018;hp=48869b4b4d640c81aa3d39adf87cb6356caee44a;hb=ea5db1975df3a208798ce2c44dc71fb8123fabd3;hpb=f6e14409afddc74ea8ffb1d852c316a5374caf2c diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index 48869b4..d3b1b65 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -219,6 +219,16 @@ sendNotification TextDocumentDidOpen params = do modify (\s -> s { vfs = newVFS }) sendNotification' n +-- | Close a virtual file if we send a close text document notification +sendNotification TextDocumentDidClose params = do + let params' = fromJust $ decode $ encode params + n :: DidCloseTextDocumentNotification + n = NotificationMessage "2.0" TextDocumentDidClose params' + oldVFS <- vfs <$> get + newVFS <- liftIO $ closeVFS oldVFS n + modify (\s -> s { vfs = newVFS }) + sendNotification' n + sendNotification method params = sendNotification' (NotificationMessage "2.0" method params) sendNotification' :: (ToJSON a, ToJSON b) => NotificationMessage a b -> Session ()