Skip to content

Commit 653aada

Browse files
committed
refactor: inline one off function
Signed-off-by: Rudi Grinberg <[email protected]> ps-id: 2180BF08-5069-4066-B15D-BFB5D3A645D3
1 parent 4e9369c commit 653aada

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

ocaml-lsp-server/src/ocaml_lsp_server.ml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -714,22 +714,21 @@ let definition_query server (state : State.t) uri position merlin_request =
714714
in
715715
None
716716

717-
let await_no_cancel task =
718-
let+ res = Lev_fiber.Thread.await task in
719-
match res with
720-
| Ok s -> s
721-
| Error `Cancelled -> assert false
722-
| Error (`Exn exn) -> Exn_with_backtrace.reraise exn
723-
724717
let workspace_symbol server (state : State.t) (params : WorkspaceSymbolParams.t)
725718
=
726719
let* symbols, errors =
727720
let workspaces = Workspaces.workspace_folders (State.workspaces state) in
728721
let* thread = Lazy_fiber.force state.symbols_thread in
729722
let+ symbols_results =
730-
Lev_fiber.Thread.task thread ~f:(fun () ->
731-
Workspace_symbol.run params workspaces)
732-
>>= await_no_cancel
723+
let* task =
724+
Lev_fiber.Thread.task thread ~f:(fun () ->
725+
Workspace_symbol.run params workspaces)
726+
in
727+
let+ res = Lev_fiber.Thread.await task in
728+
match res with
729+
| Ok s -> s
730+
| Error `Cancelled -> assert false
731+
| Error (`Exn exn) -> Exn_with_backtrace.reraise exn
733732
in
734733
List.partition_map symbols_results ~f:(function
735734
| Ok r -> Left r

0 commit comments

Comments
 (0)