Skip to content

Commit

Permalink
chore: Some comments and cleanup for LSP refactor (semgrep/semgrep-pr…
Browse files Browse the repository at this point in the history
…oprietary#1964)

## Test plan
CI passes

synced from Pro 495eb8a5295495edd9348b376ab29d284fdf2da6
  • Loading branch information
ajbt200128 authored and nmote committed Aug 6, 2024
1 parent 31ee88c commit e33db61
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/osemgrep/cli_lsp/Lsp_subcommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type caps = < Cap.random ; Cap.network ; Cap.tmp >
(* Set IO here since it is specific to the LS entrypoint *)
(* This one utilizes unix IO, but the JS version does not *)
module Io : RPC_server.LSIO = struct
open
module RPC_IO =
Lsp.Io.Make
(struct
include Lwt
Expand Down Expand Up @@ -46,15 +46,14 @@ module Io : RPC_server.LSIO = struct
read_exactly [] n
end)

let read () = read Lwt_io.stdin
let write packet = Lwt_io.atomic (fun oc -> write oc packet) Lwt_io.stdout
let read () = RPC_IO.read Lwt_io.stdin

let write packet =
Lwt_io.atomic (fun oc -> RPC_IO.write oc packet) Lwt_io.stdout

let flush () = Lwt_io.flush Lwt_io.stdout
end

(*****************************************************************************)
(* Helpers *)
(*****************************************************************************)

(*****************************************************************************)
(* Main logic *)
(*****************************************************************************)
Expand Down
2 changes: 1 addition & 1 deletion src/osemgrep/language_server/server/RPC_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ let set_async_exception_hook () =
Lwt.async_exception_hook :=
fun e ->
Lwt.async (fun () ->
let error = notify_and_log_error "Uncaught async exception" e in
let error = notify_and_log_error "Uncaught exception" e in
Lwt_list.iter_s send error)

(* NOTE: this function is only used by the native version of the extension,
Expand Down

0 comments on commit e33db61

Please sign in to comment.