From bddb67fa5cccb09d3cbfc30cb93678835b169f5e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 16 May 2024 21:46:21 -0600 Subject: [PATCH] _ Signed-off-by: Rudi Grinberg --- .../test/e2e-new/action_inline.ml | 5 +- ocaml-lsp-server/test/e2e-new/completion.ml | 123 ++---------------- ocaml-lsp-server/test/e2e-new/completions.ml | 11 +- ocaml-lsp-server/test/e2e-new/dune | 1 + ocaml-lsp-server/test/e2e-new/helpers.mli | 5 +- 5 files changed, 18 insertions(+), 127 deletions(-) diff --git a/ocaml-lsp-server/test/e2e-new/action_inline.ml b/ocaml-lsp-server/test/e2e-new/action_inline.ml index 5b4350761..ec574d9ba 100644 --- a/ocaml-lsp-server/test/e2e-new/action_inline.ml +++ b/ocaml-lsp-server/test/e2e-new/action_inline.ml @@ -278,10 +278,7 @@ let _ = let $f : int -> int = fun x -> x in f 0 |}; - [%expect {| - let _ = - let f : int -> int = fun x -> x in - (0) |}] + [%expect {| |}] let%expect_test "" = inline_test diff --git a/ocaml-lsp-server/test/e2e-new/completion.ml b/ocaml-lsp-server/test/e2e-new/completion.ml index edfb96273..1a9ee961f 100644 --- a/ocaml-lsp-server/test/e2e-new/completion.ml +++ b/ocaml-lsp-server/test/e2e-new/completion.ml @@ -174,7 +174,7 @@ let%expect_test "can start completion after operator with space" = let position = Position.create ~line:0 ~character:16 in print_completions source position; [%expect - {| + {| Completions: { "detail": "('a -> 'b) -> 'a list -> 'b list", @@ -587,7 +587,7 @@ let somenum = 42 let somestring = "hello" let plus_42 (x:int) (y:int) = - somenum + + somenum + |ocaml} in let position = Position.create ~line:5 ~character:12 in @@ -596,134 +596,31 @@ let plus_42 (x:int) (y:int) = {| Completions: { - "kind": 14, - "label": "in", - "textEdit": { - "newText": "in", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "int", + "detail": "int -> int -> int", "kind": 12, - "label": "somenum", + "label": "+", "sortText": "0000", "textEdit": { - "newText": "somenum", + "newText": "+", "range": { "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } + "start": { "character": 11, "line": 5 } } } } { - "detail": "int", + "detail": "float -> float -> float", "kind": 12, - "label": "x", + "label": "+.", "sortText": "0001", "textEdit": { - "newText": "x", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "int", - "kind": 12, - "label": "y", - "sortText": "0002", - "textEdit": { - "newText": "y", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "int", - "kind": 12, - "label": "max_int", - "sortText": "0003", - "textEdit": { - "newText": "max_int", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "int", - "kind": 12, - "label": "min_int", - "sortText": "0004", - "textEdit": { - "newText": "min_int", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "int -> int", - "kind": 12, - "label": "abs", - "sortText": "0005", - "textEdit": { - "newText": "abs", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "in_channel -> int", - "kind": 12, - "label": "in_channel_length", - "sortText": "0006", - "textEdit": { - "newText": "in_channel_length", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "in_channel -> int", - "kind": 12, - "label": "input_binary_int", - "sortText": "0007", - "textEdit": { - "newText": "input_binary_int", - "range": { - "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } - } - } - } - { - "detail": "in_channel -> int", - "kind": 12, - "label": "input_byte", - "sortText": "0008", - "textEdit": { - "newText": "input_byte", + "newText": "+.", "range": { "end": { "character": 12, "line": 5 }, - "start": { "character": 12, "line": 5 } + "start": { "character": 11, "line": 5 } } } } - ............. |}] let%expect_test "completes labels" = diff --git a/ocaml-lsp-server/test/e2e-new/completions.ml b/ocaml-lsp-server/test/e2e-new/completions.ml index 729481056..08eec8555 100644 --- a/ocaml-lsp-server/test/e2e-new/completions.ml +++ b/ocaml-lsp-server/test/e2e-new/completions.ml @@ -1,4 +1,3 @@ -open Async open Test.Import let print_completion @@ -49,11 +48,11 @@ let foo_value = foo ?a type. The LSP could filter these to exclude those that don't match the [?] prefix, but since the LSP already relies on the clients to do filtering, it feels weird to add filtering to the LSP. *) - let%map.Deferred () = Helpers.test source req in + Helpers.test source req; [%expect {| { - "detail": "'a option", + "detail": "'a", "kind": 5, "label": "~aaa", "sortText": "0000", @@ -66,7 +65,7 @@ let foo_value = foo ?a } } { - "detail": "'b option", + "detail": "'b", "kind": 5, "label": "~aab", "sortText": "0001", @@ -93,7 +92,7 @@ let foo_value = foo ?a } **************************************** { - "detail": "'a option", + "detail": "'a", "kind": 5, "label": "?aaa", "sortText": "0000", @@ -106,7 +105,7 @@ let foo_value = foo ?a } } { - "detail": "'b option", + "detail": "'b", "kind": 5, "label": "?aab", "sortText": "0001", diff --git a/ocaml-lsp-server/test/e2e-new/dune b/ocaml-lsp-server/test/e2e-new/dune index ca5b03068..fe4d8b125 100644 --- a/ocaml-lsp-server/test/e2e-new/dune +++ b/ocaml-lsp-server/test/e2e-new/dune @@ -45,6 +45,7 @@ action_mark_remove code_actions completion + completions doc_to_md document_flow exit_notification diff --git a/ocaml-lsp-server/test/e2e-new/helpers.mli b/ocaml-lsp-server/test/e2e-new/helpers.mli index a30955b00..8aa6aba9b 100644 --- a/ocaml-lsp-server/test/e2e-new/helpers.mli +++ b/ocaml-lsp-server/test/e2e-new/helpers.mli @@ -3,7 +3,4 @@ open Test.Import val uri : Uri.t val test : - ?extra_env:string list - -> string - -> (unit Client.t -> unit Fiber.t) - -> unit Async.Deferred.t + ?extra_env:string list -> string -> (unit Client.t -> unit Fiber.t) -> unit