diff --git a/dune-project b/dune-project index ae5efa96..f6f6e0fc 100644 --- a/dune-project +++ b/dune-project @@ -1,2 +1,3 @@ (lang dune 2.0) +;(implicit_transitive_deps false) (using menhir 2.0) diff --git a/linol-lwt.opam b/linol-lwt.opam new file mode 100644 index 00000000..129aa4d3 --- /dev/null +++ b/linol-lwt.opam @@ -0,0 +1,27 @@ +opam-version: "2.0" +version: "0.1" +maintainer: "simon.cruanes.2007@m4x.org" +author: "Simon Cruanes" +homepage: "https://github.com/c-cube/linol" +synopsis: "LSP server library (with Lwt for concurrency)" +build: [ + ["dune" "build" "@install" "-p" name "-j" jobs] + ["dune" "build" "@runtest" "-p" name "-j" jobs] {with-test} + ["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc} +] +depends: [ + "dune" { >= "2.0" } + "linol" { = version } + "lsp" { >= "1.4" & < "1.5" } + "jsonrpc" { >= "1.4" & < "1.5" } + "containers" { >= "3.0" & < "4.0" } + "lwt" { >= "5.1" & < "6.0" } + "yojson" { >= "1.6" } + "ocaml" { >= "4.08" } + "odoc" { with-doc } +] +tags: [ "lsp" "server" "lwt" "linol" ] +bug-reports: "https://github.com/c-cube/linol/issues" +dev-repo: "git+https://github.com/c-cube/linol.git" + + diff --git a/linol.opam b/linol.opam index 28624e7d..e772c77a 100644 --- a/linol.opam +++ b/linol.opam @@ -10,10 +10,9 @@ build: [ ["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc} ] depends: [ - "dune" { >= "1.0" } + "dune" { >= "2.0" } "containers" { >= "3.0" & < "4.0" } "lsp" { >= "1.4" & < "1.5" } - "lwt" { >= "5.1" & < "6.0" } "ocaml" { >= "4.08" } "odoc" { with-doc } ] diff --git a/src/lsp_server.ml b/src/linol.ml similarity index 97% rename from src/lsp_server.ml rename to src/linol.ml index addaf9c5..0456e816 100644 --- a/src/lsp_server.ml +++ b/src/linol.ml @@ -1,4 +1,10 @@ +(** {1 Linol} + + Abstraction over The "Lsp" library, to make it easier to develop + LSP servers in OCaml (but not necessarily {b for} OCaml). *) + +(** {2 Parametrized IO Interface} *) module type IO = sig type 'a t val return : 'a -> 'a t @@ -10,6 +16,7 @@ module type IO = sig type out_channel end +(** {2 Server interface for some IO substrate} *) module Make(IO : IO) = struct open Lsp.Types diff --git a/src/lwt/dune b/src/lwt/dune new file mode 100644 index 00000000..23acaeb5 --- /dev/null +++ b/src/lwt/dune @@ -0,0 +1,6 @@ + +(library + (name linol_lwt) + (public_name linol-lwt) + (libraries yojson containers lwt lwt.unix linol lsp jsonrpc) + (flags :standard -warn-error -a)) diff --git a/src/jsonrpc2.ml b/src/lwt/jsonrpc2.ml similarity index 99% rename from src/jsonrpc2.ml rename to src/lwt/jsonrpc2.ml index 6aa79245..fdad4d1b 100644 --- a/src/jsonrpc2.ml +++ b/src/lwt/jsonrpc2.ml @@ -20,7 +20,7 @@ module IO = struct type out_channel = Lwt_io.output Lwt_io.channel end -include Lsp_server.Make(IO) +include Linol.Make(IO) type json = J.t type 'a m = 'a Task.m diff --git a/src/jsonrpc2.mli b/src/lwt/jsonrpc2.mli similarity index 86% rename from src/jsonrpc2.mli rename to src/lwt/jsonrpc2.mli index 0be3aa49..2d4df74b 100644 --- a/src/jsonrpc2.mli +++ b/src/lwt/jsonrpc2.mli @@ -1,5 +1,5 @@ -module IO : Lsp_server.IO +module IO : Linol.IO with type 'a t = 'a Task.m and type in_channel = Lwt_io.input Lwt_io.channel and type out_channel = Lwt_io.output Lwt_io.channel @@ -9,7 +9,7 @@ type json = Yojson.Safe.t type t (** A jsonrpc2 connection. *) -include module type of Lsp_server.Make(IO) +include module type of Linol.Make(IO) val create : ic:IO.in_channel -> diff --git a/src/lsp_lwt.ml b/src/lwt/linol_lwt.ml similarity index 62% rename from src/lsp_lwt.ml rename to src/lwt/linol_lwt.ml index 33acb688..0247ac07 100644 --- a/src/lsp_lwt.ml +++ b/src/lwt/linol_lwt.ml @@ -1,6 +1,6 @@ -module type IO = Lsp_server.IO -module Make = Lsp_server.Make +module type IO = Linol.IO +module Make = Linol.Make module Jsonrpc2 = Jsonrpc2 module Task = Task diff --git a/src/task.ml b/src/lwt/task.ml similarity index 100% rename from src/task.ml rename to src/lwt/task.ml diff --git a/src/task.mli b/src/lwt/task.mli similarity index 100% rename from src/task.mli rename to src/lwt/task.mli