Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fix `inlay-hint` for function parameters (#1515)
- More precise diagnostics in the event of a failed identifier search (`Definition_query`) (#1518)
- Remove `ocamlformat` application after `destruct` (that remove some useful parenthesis) (#1519)
- Drop `open related file` code action (at every position) (#1520)

# 1.22.0

Expand Down
6 changes: 2 additions & 4 deletions ocaml-lsp-server/src/code_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,18 @@ let compute server (params : CodeActionParams.t) =
let* window = (State.client_capabilities state).window in
window.showDocument
in
let open_related = Action_open_related.for_uri capabilities doc in
let* merlin_jumps =
match state.configuration.data.merlin_jump_code_actions with
| Some { enable = true } -> Action_jump.code_actions doc params capabilities
| Some { enable = false } | None -> Fiber.return []
in
(match Document.syntax doc with
| Ocamllex | Menhir | Cram | Dune ->
Fiber.return (Reply.now (actions (dune_actions @ open_related)), state)
Fiber.return (Reply.now (actions dune_actions), state)
| Ocaml | Reason ->
let reply () =
let+ code_action_results = compute_ocaml_code_actions params state doc in
List.concat [ code_action_results; dune_actions; open_related; merlin_jumps ]
|> actions
List.concat [ code_action_results; dune_actions; merlin_jumps ] |> actions
in
let later f =
Fiber.return
Expand Down
27 changes: 2 additions & 25 deletions ocaml-lsp-server/test/e2e-new/code_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,7 @@ let foo = 123
"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"
} |}]
|}]
;;

let%expect_test "can type-annotate a function argument" =
Expand Down Expand Up @@ -169,19 +158,7 @@ let iiii = 3 + 4
"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"
}
|}]
|}]
;;

let%expect_test "does not type-annotate function" =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,25 +267,6 @@ let x = _
"kind": "refactor.extract",
"title": "Extract function",
},
{
"command": {
"arguments": [
"file:///test.mli",
],
"command": "ocamllsp/open-related-source",
"title": "Create test.mli",
},
"edit": {
"documentChanges": [
{
"kind": "create",
"uri": "file:///test.mli",
},
],
},
"kind": "switch",
"title": "Create test.mli",
},
]
`);

Expand Down