Merge branch 'vendor-lsp'

This commit is contained in:
Simon Cruanes 2025-04-07 13:32:20 -04:00
commit f83580c8c1
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
22 changed files with 64 additions and 41 deletions

View file

@ -10,7 +10,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@main - uses: actions/checkout@main
with:
submodules: 'recursive'
- uses: ocaml/setup-ocaml@v3 - uses: ocaml/setup-ocaml@v3
with: with:
ocaml-compiler: '5.2' ocaml-compiler: '5.2'

View file

@ -15,6 +15,8 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@main - uses: actions/checkout@main
with:
submodules: 'recursive'
- uses: ocaml/setup-ocaml@v3 - uses: ocaml/setup-ocaml@v3
with: with:
ocaml-compiler: ${{ matrix.ocaml-compiler }} ocaml-compiler: ${{ matrix.ocaml-compiler }}
@ -37,21 +39,17 @@ jobs:
- 5.1.x - 5.1.x
- 5.2.x - 5.2.x
- 5.3.x - 5.3.x
lsp-version:
- 1.19.0
- 1.20.1
- 1.22.0
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@main - uses: actions/checkout@main
with:
submodules: 'recursive'
- uses: ocaml/setup-ocaml@v3 - uses: ocaml/setup-ocaml@v3
with: with:
ocaml-compiler: ${{ matrix.ocaml-compiler }} ocaml-compiler: ${{ matrix.ocaml-compiler }}
dune-cache: true dune-cache: true
allow-prerelease-opam: true allow-prerelease-opam: true
- run: opam pin -n . - run: opam pin -n .
- run: opam pin add jsonrpc ${{ matrix.lsp-version }}
- run: opam pin add lsp ${{ matrix.lsp-version }}
- run: opam depext -yt linol linol-lwt linol-eio - run: opam depext -yt linol linol-lwt linol-eio
- run: opam install -t . --deps-only - run: opam install -t . --deps-only
- run: opam exec -- dune build - run: opam exec -- dune build

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "submodules/ocaml-lsp"]
path = submodules/ocaml-lsp
url = https://github.com/ocaml/ocaml-lsp.git

View file

@ -16,6 +16,9 @@ doc:
fmt: fmt:
@dune build @fmt --auto-promote @dune build @fmt --auto-promote
update-submodules:
@git submodule update --init
VERSION=$(shell awk '/^version:/ {print $$2}' linol.opam) VERSION=$(shell awk '/^version:/ {print $$2}' linol.opam)
update_next_tag: update_next_tag:

1
dune Normal file
View file

@ -0,0 +1 @@
(data_only_dirs submodules)

View file

@ -28,17 +28,14 @@
"logs" "logs"
("trace" ("trace"
(>= "0.4")) (>= "0.4"))
("lsp"
(and
(>= "1.19")
(< "1.23")))
("jsonrpc"
(and
(>= "1.19")
(< "1.23")))
("ocaml" ("ocaml"
(>= "4.14")) (>= "4.14"))
("odoc" :with-doc))) ("odoc" :with-doc)
; The following dependencies are needed for lsp, which we vendor
(uutf
(>= 1.0.2))
(ppx_yojson_conv_lib
(>= "v0.14"))))
(package (package
(name linol-lwt) (name linol-lwt)
@ -53,14 +50,6 @@
(and (and
(>= "5.1") (>= "5.1")
(< "6.0"))) (< "6.0")))
("lsp"
(and
(>= "1.19")
(< "1.23")))
("jsonrpc"
(and
(>= "1.19")
(< "1.23")))
("odoc" :with-doc))) ("odoc" :with-doc)))
(package (package
@ -78,12 +67,4 @@
(>= "1.0") (>= "1.0")
(< "2.0"))) (< "2.0")))
(eio_main :with-test) (eio_main :with-test)
("lsp"
(and
(>= "1.19")
(< "1.23")))
("jsonrpc"
(and
(>= "1.19")
(< "1.23")))
("odoc" :with-doc))) ("odoc" :with-doc)))

View file

@ -15,6 +15,8 @@
of a document are expected to be able to return. of a document are expected to be able to return.
*) *)
module Lsp = Linol.Lsp
type state_after_processing = unit type state_after_processing = unit
let process_some_input_file (_file_contents : string) : state_after_processing = let process_some_input_file (_file_contents : string) : state_after_processing =

View file

@ -15,6 +15,8 @@
of a document are expected to be able to return. of a document are expected to be able to return.
*) *)
module Lsp = Linol.Lsp
type state_after_processing = unit type state_after_processing = unit
let process_some_input_file (_file_contents : string) : state_after_processing = let process_some_input_file (_file_contents : string) : state_after_processing =

View file

@ -14,8 +14,6 @@ depends: [
"base-unix" "base-unix"
"eio" {>= "1.0" & < "2.0"} "eio" {>= "1.0" & < "2.0"}
"eio_main" {with-test} "eio_main" {with-test}
"lsp" {>= "1.19" & < "1.23"}
"jsonrpc" {>= "1.19" & < "1.23"}
"odoc" {with-doc} "odoc" {with-doc}
] ]
build: [ build: [

View file

@ -13,8 +13,6 @@ depends: [
"linol" {= version} "linol" {= version}
"base-unix" "base-unix"
"lwt" {>= "5.1" & < "6.0"} "lwt" {>= "5.1" & < "6.0"}
"lsp" {>= "1.19" & < "1.23"}
"jsonrpc" {>= "1.19" & < "1.23"}
"odoc" {with-doc} "odoc" {with-doc}
] ]
build: [ build: [

View file

@ -12,10 +12,10 @@ depends: [
"yojson" {>= "1.6"} "yojson" {>= "1.6"}
"logs" "logs"
"trace" {>= "0.4"} "trace" {>= "0.4"}
"lsp" {>= "1.19" & < "1.23"}
"jsonrpc" {>= "1.19" & < "1.23"}
"ocaml" {>= "4.14"} "ocaml" {>= "4.14"}
"odoc" {with-doc} "odoc" {with-doc}
"uutf" {>= "1.0.2"}
"ppx_yojson_conv_lib" {>= "v0.14"}
] ]
build: [ build: [
["dune" "subst"] {pinned} ["dune" "subst"] {pinned}

View file

@ -1,3 +1,5 @@
module Lsp = Linol_lsp.Lsp
module Jsonrpc = Linol_jsonrpc.Jsonrpc
module Trace = Trace_core module Trace = Trace_core
let ( let@ ) = ( @@ ) let ( let@ ) = ( @@ )

View file

@ -3,4 +3,4 @@
(public_name linol) (public_name linol)
(private_modules log) (private_modules log)
(flags :standard -warn-error -a+8) (flags :standard -warn-error -a+8)
(libraries yojson lsp logs threads trace.core)) (libraries yojson logs threads trace.core (re_export linol.lsp) (re_export linol.jsonrpc)))

View file

@ -1,5 +1,5 @@
(library (library
(name linol_eio) (name linol_eio)
(public_name linol-eio) (public_name linol-eio)
(libraries eio eio.unix linol) (libraries eio eio.unix linol linol.lsp linol.jsonrpc)
(flags :standard -warn-error -a)) (flags :standard -warn-error -a))

View file

@ -1,3 +1,7 @@
open struct
module Lsp = Linol_lsp.Lsp
end
module type IO = Linol.IO module type IO = Linol.IO
module IO_eio : module IO_eio :

View file

@ -2,6 +2,7 @@
See {{: https://www.jsonrpc.org/specification} the spec} *) See {{: https://www.jsonrpc.org/specification} the spec} *)
open Common_
type json = Yojson.Safe.t type json = Yojson.Safe.t
module type IO = Sigs.IO module type IO = Sigs.IO

View file

@ -3,8 +3,16 @@
Abstraction over The "Lsp" library, to make it easier to develop Abstraction over The "Lsp" library, to make it easier to develop
LSP servers in OCaml (but not necessarily {b for} OCaml). *) LSP servers in OCaml (but not necessarily {b for} OCaml). *)
module type IO = Sigs.IO module type IO = Sigs.IO
(** {2 Re-export from vendored lsp} *)
module Lsp = Linol_lsp.Lsp
module Jsonrpc = Linol_jsonrpc.Jsonrpc
(** {2 Main modules} *)
module Jsonrpc2 = Jsonrpc2 module Jsonrpc2 = Jsonrpc2
module Server = Server module Server = Server
module Blocking_IO = Blocking_IO module Blocking_IO = Blocking_IO

View file

@ -1,5 +1,5 @@
(library (library
(name linol_lwt) (name linol_lwt)
(public_name linol-lwt) (public_name linol-lwt)
(libraries yojson lwt lwt.unix linol lsp jsonrpc) (libraries yojson lwt lwt.unix linol linol.lsp linol.jsonrpc)
(flags :standard -warn-error -a)) (flags :standard -warn-error -a))

View file

@ -1,3 +1,7 @@
open struct
module Lsp = Linol_lsp.Lsp
end
module type IO = Linol.IO module type IO = Linol.IO
module IO_lwt : module IO_lwt :

1
submodules/ocaml-lsp Submodule

@ -0,0 +1 @@
Subproject commit aae6986391a8519de3da6a7a341f2bd3376e0d2f

5
vendor/jsonrpc/dune vendored Normal file
View file

@ -0,0 +1,5 @@
(copy_files %{project_root}/submodules/ocaml-lsp/jsonrpc/src/*.{ml,mli})
(library
(name linol_jsonrpc)
(public_name linol.jsonrpc))

11
vendor/lsp/dune vendored Normal file
View file

@ -0,0 +1,11 @@
(copy_files %{project_root}/submodules/ocaml-lsp/lsp/src/*.{ml,mli,mll})
(library
(name linol_lsp)
(public_name linol.lsp)
(libraries linol_jsonrpc ppx_yojson_conv_lib uutf yojson)
(flags :standard -open Linol_jsonrpc)
(lint
(pps ppx_yojson_conv)))
(ocamllex uri_lexer)