Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed May 17, 2024
1 parent b674bd4 commit bddb67f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 127 deletions.
5 changes: 1 addition & 4 deletions ocaml-lsp-server/test/e2e-new/action_inline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
123 changes: 10 additions & 113 deletions ocaml-lsp-server/test/e2e-new/completion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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" =
Expand Down
11 changes: 5 additions & 6 deletions ocaml-lsp-server/test/e2e-new/completions.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
open Async
open Test.Import

let print_completion
Expand Down Expand Up @@ -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",
Expand All @@ -66,7 +65,7 @@ let foo_value = foo ?a
}
}
{
"detail": "'b option",
"detail": "'b",
"kind": 5,
"label": "~aab",
"sortText": "0001",
Expand All @@ -93,7 +92,7 @@ let foo_value = foo ?a
}
****************************************
{
"detail": "'a option",
"detail": "'a",
"kind": 5,
"label": "?aaa",
"sortText": "0000",
Expand All @@ -106,7 +105,7 @@ let foo_value = foo ?a
}
}
{
"detail": "'b option",
"detail": "'b",
"kind": 5,
"label": "?aab",
"sortText": "0001",
Expand Down
1 change: 1 addition & 0 deletions ocaml-lsp-server/test/e2e-new/dune
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
action_mark_remove
code_actions
completion
completions
doc_to_md
document_flow
exit_notification
Expand Down
5 changes: 1 addition & 4 deletions ocaml-lsp-server/test/e2e-new/helpers.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bddb67f

Please sign in to comment.