From 8a058ba4bb95d93cea7da033daf90c9a435b0140 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 2 Aug 2022 20:10:12 -0500 Subject: [PATCH] test: add showDocumentCapabilities to make sure we can use all these features ps-id: f9f12c10-f20b-492b-8d66-af1d54c0fa9a --- ocaml-lsp-server/test/e2e-new/code_actions.ml | 22 ++++++++++++++++++- ocaml-lsp-server/test/e2e-new/start_stop.ml | 17 ++++++++++++-- .../__tests__/textDocument-codeAction.test.ts | 7 +++++- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ocaml-lsp-server/test/e2e-new/code_actions.ml b/ocaml-lsp-server/test/e2e-new/code_actions.ml index 60f798f3c..d6594ae40 100644 --- a/ocaml-lsp-server/test/e2e-new/code_actions.ml +++ b/ocaml-lsp-server/test/e2e-new/code_actions.ml @@ -9,7 +9,15 @@ let foo = 123 in ( Test.run ~handler @@ fun client -> let run_client () = - let capabilities = ClientCapabilities.create () in + let capabilities = + let window = + let showDocument = + ShowDocumentClientCapabilities.create ~support:true + in + WindowClientCapabilities.create ~showDocument () + in + ClientCapabilities.create ~window () + in Client.start client (InitializeParams.create ~capabilities ()) in let run = @@ -73,4 +81,16 @@ let foo = 123 "isPreferred": false, "kind": "type-annotate", "title": "Type-annotate" + } + { + "command": { + "arguments": [ "file:///foo.mli" ], + "command": "ocamllsp/open-related-source", + "title": "Create foo.mli" + }, + "edit": { + "documentChanges": [ { "kind": "create", "uri": "file:///foo.mli" } ] + }, + "kind": "switch", + "title": "Create foo.mli" } |}] diff --git a/ocaml-lsp-server/test/e2e-new/start_stop.ml b/ocaml-lsp-server/test/e2e-new/start_stop.ml index 103825534..1997f3705 100644 --- a/ocaml-lsp-server/test/e2e-new/start_stop.ml +++ b/ocaml-lsp-server/test/e2e-new/start_stop.ml @@ -3,7 +3,15 @@ open Test.Import let%expect_test "start/stop" = ( Test.run @@ fun client -> let run_client () = - let capabilities = ClientCapabilities.create () in + let capabilities = + let window = + let showDocument = + ShowDocumentClientCapabilities.create ~support:true + in + WindowClientCapabilities.create ~showDocument () + in + ClientCapabilities.create ~window () + in Client.start client (InitializeParams.create ~capabilities ()) in let print_init = @@ -42,7 +50,12 @@ let%expect_test "start/stop" = "documentFormattingProvider": true, "documentHighlightProvider": true, "documentSymbolProvider": true, - "executeCommandProvider": { "commands": [ "dune/promote" ] }, + "executeCommandProvider": { + "commands": [ + "ocamllsp/view-metrics", "ocamllsp/open-related-source", + "dune/promote" + ] + }, "experimental": { "ocamllsp": { "interfaceSpecificLangId": true, diff --git a/ocaml-lsp-server/test/e2e/__tests__/textDocument-codeAction.test.ts b/ocaml-lsp-server/test/e2e/__tests__/textDocument-codeAction.test.ts index 445ac65bf..654259e98 100644 --- a/ocaml-lsp-server/test/e2e/__tests__/textDocument-codeAction.test.ts +++ b/ocaml-lsp-server/test/e2e/__tests__/textDocument-codeAction.test.ts @@ -65,7 +65,12 @@ describe("textDocument/codeAction", () => { beforeEach(async () => { languageServer = await LanguageServer.startAndInitialize({ - capabilities: { experimental: { jumpToNextHole: true } }, + capabilities: { + experimental: { jumpToNextHole: true }, + window: { + showDocument: { support: true }, + }, + }, }); });