Skip to content

Commit

Permalink
test: add showDocumentCapabilities
Browse files Browse the repository at this point in the history
to make sure we can use all these features

ps-id: f9f12c10-f20b-492b-8d66-af1d54c0fa9a
  • Loading branch information
rgrinberg committed Aug 17, 2022
1 parent b63b33d commit f2c8aa3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
22 changes: 21 additions & 1 deletion ocaml-lsp-server/test/e2e-new/code_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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"
} |}]
17 changes: 15 additions & 2 deletions ocaml-lsp-server/test/e2e-new/start_stop.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
},
},
});
});

Expand Down

0 comments on commit f2c8aa3

Please sign in to comment.