mirror of
https://github.com/c-cube/linol.git
synced 2025-12-06 03:05:31 -05:00
refactor: split into lwt server and abstract interface
This commit is contained in:
parent
33be161bd9
commit
8dff582612
10 changed files with 47 additions and 7 deletions
|
|
@ -1,2 +1,3 @@
|
|||
(lang dune 2.0)
|
||||
;(implicit_transitive_deps false)
|
||||
(using menhir 2.0)
|
||||
|
|
|
|||
27
linol-lwt.opam
Normal file
27
linol-lwt.opam
Normal file
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
@ -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 }
|
||||
]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
6
src/lwt/dune
Normal file
6
src/lwt/dune
Normal file
|
|
@ -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))
|
||||
|
|
@ -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
|
||||
|
|
@ -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 ->
|
||||
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Reference in a new issue