X-Git-Url: http://git.lukelau.me/?a=blobdiff_plain;f=src%2FLanguage%2FHaskell%2FLSP%2FTest.hs;h=dbfc8012973e0165ce97a9c508b440f380b1371e;hb=refs%2Ftags%2F0.11.0.3;hp=81bdc8a8b465087baa960fbc6b1303e8497fcff7;hpb=a7fd35b1582f9816d8caa90a7b2e3aa765fb0446;p=lsp-test.git diff --git a/src/Language/Haskell/LSP/Test.hs b/src/Language/Haskell/LSP/Test.hs index 81bdc8a..dbfc801 100644 --- a/src/Language/Haskell/LSP/Test.hs +++ b/src/Language/Haskell/LSP/Test.hs @@ -611,9 +611,12 @@ getDefinitions doc pos = do getTypeDefinitions :: TextDocumentIdentifier -- ^ The document the term is in. -> Position -- ^ The position the term is at. -> Session [Location] -- ^ The location(s) of the definitions -getTypeDefinitions doc pos = +getTypeDefinitions doc pos = do let params = TextDocumentPositionParams doc pos Nothing - in getResponseResult <$> request TextDocumentTypeDefinition params + rsp <- request TextDocumentTypeDefinition params :: Session TypeDefinitionResponse + case getResponseResult rsp of + SingleLoc loc -> pure [loc] + MultiLoc locs -> pure locs -- | Renames the term at the specified position. rename :: TextDocumentIdentifier -> Position -> String -> Session () @@ -661,6 +664,7 @@ formatRange doc opts range = do applyTextEdits :: TextDocumentIdentifier -> List TextEdit -> Session () applyTextEdits doc edits = let wEdit = WorkspaceEdit (Just (HashMap.singleton (doc ^. uri) edits)) Nothing + -- Send a dummy message to updateState so it can do bookkeeping req = RequestMessage "" (IdInt 0) WorkspaceApplyEdit (ApplyWorkspaceEditParams wEdit) in updateState (ReqApplyWorkspaceEdit req)