Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
maximedenes committed Oct 27, 2023
1 parent bde53d2 commit 6dee1b6
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 686 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-compiler:
#- "4.11.0"
- "4.14.1"
Expand Down
6 changes: 3 additions & 3 deletions controller/jasminlsp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ open Controller
let log msg = Format.eprintf " [%d, %f] %s" (Unix.getpid ()) (Unix.gettimeofday ()) msg

let loop () =
let rec loop (todo : LspManager.event Sel.todo) =
let rec loop (todo : LspManager.event Sel.Todo.t) =
flush_all ();
let ready, todo = Sel.pop todo in
let new_events = LspManager.handle_event ready in
let todo = Sel.enqueue todo new_events in
let todo = Sel.Todo.add todo new_events in
loop todo
in
let todo = Sel.enqueue Sel.empty [LspManager.lsp] in
let todo = Sel.Todo.add Sel.Todo.empty [LspManager.lsp] in
try loop todo
with exn ->
log @@ "Exception raised: " ^ (Printexc.to_string exn)
Expand Down
12 changes: 5 additions & 7 deletions controller/lspManager.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type lsp_event =
type event =
| LspManagerEvent of lsp_event

type events = event Sel.event list
type events = event Sel.Event.t list

let lsp : event Sel.event =
Sel.on_httpcle Unix.stdin (function
let lsp : event Sel.Event.t =
Sel.On.httpcle Unix.stdin (function
| Ok buff ->
begin
log "UI req ready";
Expand All @@ -30,9 +30,6 @@ let lsp : event Sel.event =
| Error exn ->
log @@ ("failed to read message: " ^ Printexc.to_string exn);
exit 0)
|> fst
|> Sel.name "lsp"
|> Sel.make_recurring

let output_json obj =
let msg = Yojson.Safe.pretty_to_string ~std:true obj in
Expand Down Expand Up @@ -230,8 +227,9 @@ let dispatch_notification =

let handle_lsp_event = function
| JsonRpc None ->
[]
[lsp]
| JsonRpc (Some rpc) ->
lsp ::
match rpc with
| Request req ->
log @@ "ui request: " ^ req.method_;
Expand Down
4 changes: 2 additions & 2 deletions controller/lspManager.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type event
type events = event Sel.event list
type events = event Sel.Event.t list

val lsp : event Sel.event
val lsp : event Sel.Event.t

val handle_event : event -> events
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
jsonrpc
lsp
menhirLib
sel
]);
propagatedBuildInputs =
pkgs.jasmin-compiler.propagatedBuildInputs;
Expand Down
130 changes: 0 additions & 130 deletions sel/README.md

This file was deleted.

6 changes: 0 additions & 6 deletions sel/dune

This file was deleted.

Loading

0 comments on commit 6dee1b6

Please sign in to comment.