X-Git-Url: https://git.lukelau.me/?p=lsp-test.git;a=blobdiff_plain;f=test%2Fdummy-server%2FMain.hs;h=a7e6439078ead5af4db0275c3863bc610294d5e1;hp=f67b043a2f213fb873650b0d2e814e614c82d818;hb=ea87bf94ca92b6de74505ba8df208ad3e2110de5;hpb=4ff79e19cd03626adcf6b01d1259918260820fb1 diff --git a/test/dummy-server/Main.hs b/test/dummy-server/Main.hs index f67b043..a7e6439 100644 --- a/test/dummy-server/Main.hs +++ b/test/dummy-server/Main.hs @@ -35,8 +35,8 @@ handlers lfvar = def Nothing SkObject Nothing - (Range (Position 0 0) (Position 0 1)) - (Range (Position 0 0) (Position 0 1)) + (mkRange 0 0 3 6) + (mkRange 0 0 3 6) Nothing ] , didOpenTextDocumentNotificationHandler = pure $ \noti -> @@ -44,7 +44,7 @@ handlers lfvar = def threadDelay (2 * 10^6) let NotificationMessage _ _ (DidOpenTextDocumentParams doc) = noti TextDocumentItem uri _ _ _ = doc - diag = Diagnostic (Range (Position 0 0) (Position 0 1)) + diag = Diagnostic (mkRange 0 0 0 1) (Just DsWarning) (Just (NumberValue 42)) (Just "dummy-server") @@ -58,7 +58,7 @@ handlers lfvar = def reqId <- readMVar lfvar >>= getNextReqId let RequestMessage _ _ _ (ExecuteCommandParams "doAnEdit" (Just (List [val])) _) = req Success docUri = fromJSON val - edit = List [TextEdit (Range (Position 0 0) (Position 0 5)) "howdy"] + edit = List [TextEdit (mkRange 0 0 0 5) "howdy"] send $ ReqApplyWorkspaceEdit $ fmServerApplyWorkspaceEditRequest reqId $ ApplyWorkspaceEditParams $ WorkspaceEdit (Just (HM.singleton docUri edit)) Nothing @@ -76,3 +76,5 @@ handlers lfvar = def send $ RspCodeAction $ makeResponseMessage req caresults } where send msg = readMVar lfvar >>= \lf -> (sendFunc lf) msg + +mkRange sl sc el ec = Range (Position sl sc) (Position el ec) \ No newline at end of file