ocamlPackages.linol: 0.6 -> 0.10 (#399596)
* ocamlPackages.linol: 0.6 -> 0.10 * ocamlPackages.dolmen_lsp: fix transitive dependency and migrate to linol common types
This commit is contained in:
parent
151727b941
commit
cfe014a5a2
@ -0,0 +1,137 @@
|
||||
diff --git i/src/lsp/diagnostic.ml w/src/lsp/diagnostic.ml
|
||||
index 149cde11..bd93298a 100644
|
||||
--- i/src/lsp/diagnostic.ml
|
||||
+++ w/src/lsp/diagnostic.ml
|
||||
@@ -1,13 +1,12 @@
|
||||
-
|
||||
(* This file is free software, part of dolmen. See file "LICENSE" for more information *)
|
||||
|
||||
-type t = Lsp.Types.Diagnostic.t
|
||||
+type t = Linol__.Common_.Lsp.Types.Diagnostic.t
|
||||
|
||||
let lsp_pos line character =
|
||||
- Lsp.Types.Position.create ~line ~character
|
||||
+ Linol__.Common_.Lsp.Types.Position.create ~line ~character
|
||||
|
||||
let lsp_range start end_ =
|
||||
- Lsp.Types.Range.create ~start ~end_
|
||||
+ Linol__.Common_.Lsp.Types.Range.create ~start ~end_
|
||||
|
||||
let start_pos = lsp_pos 1 1
|
||||
let start_range = lsp_range start_pos start_pos
|
||||
@@ -23,17 +22,15 @@ let range_of_loc = function
|
||||
(lsp_pos (l.stop_line - 1) l.stop_column)
|
||||
|
||||
let warn ?loc message =
|
||||
- Lsp.Types.Diagnostic.create ()
|
||||
+ Linol__.Common_.Lsp.Types.Diagnostic.create ()
|
||||
~range:(range_of_loc loc)
|
||||
~severity:Warning
|
||||
~source:"dolmenls"
|
||||
~message
|
||||
|
||||
let error ?loc message =
|
||||
- Lsp.Types.Diagnostic.create ()
|
||||
+ Linol__.Common_.Lsp.Types.Diagnostic.create ()
|
||||
~range:(range_of_loc loc)
|
||||
~severity:Error
|
||||
~source:"dolmenls"
|
||||
~message
|
||||
-
|
||||
-
|
||||
diff --git i/src/lsp/main.ml w/src/lsp/main.ml
|
||||
index 8d6fc760..b52dd25c 100644
|
||||
--- i/src/lsp/main.ml
|
||||
+++ w/src/lsp/main.ml
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
let run () =
|
||||
let s = new Server.dolmen_lsp_server in
|
||||
- let server = Linol_lwt.Jsonrpc2.create_stdio s in
|
||||
+ let server = Linol_lwt.Jsonrpc2.create_stdio ~env:() s in
|
||||
let task = Linol_lwt.Jsonrpc2.run server in
|
||||
match Linol_lwt.run task with
|
||||
| () -> ()
|
||||
diff --git i/src/lsp/server.ml w/src/lsp/server.ml
|
||||
index e895cc6a..a01ed9fb 100644
|
||||
--- i/src/lsp/server.ml
|
||||
+++ w/src/lsp/server.ml
|
||||
@@ -44,25 +44,28 @@ class dolmen_lsp_server =
|
||||
object(self)
|
||||
inherit Linol_lwt.Jsonrpc2.server
|
||||
|
||||
+ method spawn_query_handler f = Linol_lwt.spawn f
|
||||
+
|
||||
(* one env per document *)
|
||||
- val buffers: (Lsp.Types.DocumentUri.t, State.t) Hashtbl.t = Hashtbl.create 32
|
||||
+ val buffers: (Linol__.Common_.Lsp.Types.DocumentUri.t, State.t) Hashtbl.t = Hashtbl.create 32
|
||||
|
||||
(* A list of include statements of the prelude files *)
|
||||
val mutable prelude = []
|
||||
|
||||
method! config_sync_opts =
|
||||
(* configure how sync happens *)
|
||||
- let change = Lsp.Types.TextDocumentSyncKind.Incremental in
|
||||
- (* Lsp.Types.TextDocumentSyncKind.Full *)
|
||||
- Lsp.Types.TextDocumentSyncOptions.create ~openClose:true ~change
|
||||
- ~save:(Lsp.Types.SaveOptions.create ~includeText:false ())
|
||||
+ let change = Linol__.Common_.Lsp.Types.TextDocumentSyncKind.Incremental in
|
||||
+ (* Linol__.Common_.Lsp.Types.TextDocumentSyncKind.Full *)
|
||||
+ Linol__.Common_.Lsp.Types.TextDocumentSyncOptions.create ~openClose:true ~change
|
||||
+ ~save:(`SaveOptions (Linol__.Common_.Lsp.Types.SaveOptions.create ~includeText:false ()))
|
||||
()
|
||||
|
||||
method private _on_doc
|
||||
~(notify_back:Linol_lwt.Jsonrpc2.notify_back)
|
||||
- (uri:Lsp.Types.DocumentUri.t) (contents:string) =
|
||||
+ (uri:Linol__.Common_.Lsp.Types.DocumentUri.t) (contents:string) =
|
||||
(* TODO: unescape uri/translate it to a correct path ? *)
|
||||
- match Loop.process prelude (preprocess_uri uri) (Some contents) with
|
||||
+ let uri_path = Linol__.Common_.Lsp.Uri.to_path uri in
|
||||
+ match Loop.process prelude (preprocess_uri uri_path) (Some contents) with
|
||||
| Ok state ->
|
||||
let diags = State.get State.diagnostics state in
|
||||
Hashtbl.replace buffers uri state;
|
||||
@@ -79,9 +82,9 @@ class dolmen_lsp_server =
|
||||
self#_on_doc ~notify_back d.uri new_content
|
||||
|
||||
method! on_notification_unhandled
|
||||
- ~notify_back:_ (n:Lsp.Client_notification.t) =
|
||||
+ ~notify_back:_ (n:Linol__.Common_.Lsp.Client_notification.t) =
|
||||
match n with
|
||||
- | Lsp.Client_notification.ChangeConfiguration { settings; } ->
|
||||
+ | Linol__.Common_.Lsp.Client_notification.ChangeConfiguration { settings; } ->
|
||||
begin try
|
||||
prelude <- mk_prelude (parse_settings settings);
|
||||
Linol_lwt.Jsonrpc2.IO.return ()
|
||||
@@ -89,7 +92,7 @@ class dolmen_lsp_server =
|
||||
Linol_lwt.Jsonrpc2.IO.failwith s
|
||||
end
|
||||
| _ ->
|
||||
- Lwt.return ()
|
||||
+ Linol_lwt.Jsonrpc2.IO.return ()
|
||||
|
||||
method on_notif_doc_did_close ~notify_back d =
|
||||
Hashtbl.remove buffers d.uri;
|
||||
diff --git i/src/lsp/state.ml w/src/lsp/state.ml
|
||||
index f3e89640..3f8a36ab 100644
|
||||
--- i/src/lsp/state.ml
|
||||
+++ w/src/lsp/state.ml
|
||||
@@ -45,7 +45,7 @@ let warn ?file:_ ?loc t warn payload =
|
||||
in
|
||||
Format.kfprintf (fun _ ->
|
||||
let msg = Format.flush_str_formatter () in
|
||||
- let d = Diagnostic.warn ~loc msg in
|
||||
+ let d = Diagnostic.warn ~loc (`String msg) in
|
||||
add_diag d t) Format.str_formatter "%a"
|
||||
Dolmen_loop.Report.Warning.print (warn, payload)
|
||||
|
||||
@@ -67,7 +67,7 @@ let error ?file:_ ?loc t err payload =
|
||||
(* Print the error message *)
|
||||
Format.kfprintf (fun _ ->
|
||||
let msg = Format.flush_str_formatter () in
|
||||
- let d = Diagnostic.error ~loc msg in
|
||||
+ let d = Diagnostic.error ~loc (`String msg) in
|
||||
add_diag d t) Format.str_formatter "%a"
|
||||
Dolmen_loop.Report.Error.print (err, payload)
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
diff --git a/src/lsp/main.ml b/src/lsp/main.ml
|
||||
index 8d6fc760..b52dd25c 100644
|
||||
--- a/src/lsp/main.ml
|
||||
+++ b/src/lsp/main.ml
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
let run () =
|
||||
let s = new Server.dolmen_lsp_server in
|
||||
- let server = Linol_lwt.Jsonrpc2.create_stdio s in
|
||||
+ let server = Linol_lwt.Jsonrpc2.create_stdio ~env:() s in
|
||||
let task = Linol_lwt.Jsonrpc2.run server in
|
||||
match Linol_lwt.run task with
|
||||
| () -> ()
|
||||
diff --git a/src/lsp/server.ml b/src/lsp/server.ml
|
||||
index e895cc6a..c9a3f237 100644
|
||||
--- a/src/lsp/server.ml
|
||||
+++ b/src/lsp/server.ml
|
||||
@@ -44,6 +44,8 @@ class dolmen_lsp_server =
|
||||
object(self)
|
||||
inherit Linol_lwt.Jsonrpc2.server
|
||||
|
||||
+ method spawn_query_handler _ = ()
|
||||
+
|
||||
(* one env per document *)
|
||||
val buffers: (Lsp.Types.DocumentUri.t, State.t) Hashtbl.t = Hashtbl.create 32
|
||||
|
||||
@@ -55,14 +57,14 @@ class dolmen_lsp_server =
|
||||
let change = Lsp.Types.TextDocumentSyncKind.Incremental in
|
||||
(* Lsp.Types.TextDocumentSyncKind.Full *)
|
||||
Lsp.Types.TextDocumentSyncOptions.create ~openClose:true ~change
|
||||
- ~save:(Lsp.Types.SaveOptions.create ~includeText:false ())
|
||||
+ ~save:(`SaveOptions (Lsp.Types.SaveOptions.create ~includeText:false ()))
|
||||
()
|
||||
|
||||
method private _on_doc
|
||||
~(notify_back:Linol_lwt.Jsonrpc2.notify_back)
|
||||
(uri:Lsp.Types.DocumentUri.t) (contents:string) =
|
||||
(* TODO: unescape uri/translate it to a correct path ? *)
|
||||
- match Loop.process prelude (preprocess_uri uri) (Some contents) with
|
||||
+ match Loop.process prelude (preprocess_uri (Lsp.Types.DocumentUri.to_string uri)) (Some contents) with
|
||||
| Ok state ->
|
||||
let diags = State.get State.diagnostics state in
|
||||
Hashtbl.replace buffers uri state;
|
||||
@ -7,14 +7,14 @@
|
||||
linol,
|
||||
linol-lwt,
|
||||
logs,
|
||||
# lsp, # transitive dependency from linol
|
||||
lsp,
|
||||
}:
|
||||
|
||||
buildDunePackage {
|
||||
pname = "dolmen_lsp";
|
||||
inherit (dolmen) src version;
|
||||
|
||||
patches = [ ./linol-lwt-6.patch ];
|
||||
patches = [ ./linol-common-migration.patch ];
|
||||
|
||||
buildInputs = [
|
||||
dolmen
|
||||
@ -23,7 +23,7 @@ buildDunePackage {
|
||||
linol
|
||||
linol-lwt
|
||||
logs
|
||||
# lsp # transitive dependency from linol
|
||||
lsp
|
||||
];
|
||||
|
||||
meta = dolmen.meta // {
|
||||
|
||||
@ -1,37 +1,43 @@
|
||||
{
|
||||
lib,
|
||||
fetchurl,
|
||||
fetchFromGitHub,
|
||||
buildDunePackage,
|
||||
yojson,
|
||||
logs,
|
||||
lsp,
|
||||
ppx_yojson_conv_lib,
|
||||
trace,
|
||||
uutf,
|
||||
yojson,
|
||||
}:
|
||||
|
||||
buildDunePackage rec {
|
||||
pname = "linol";
|
||||
version = "0.6";
|
||||
version = "0.10";
|
||||
|
||||
minimalOCamlVersion = "4.14";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/c-cube/linol/releases/download/v${version}/linol-${version}.tbz";
|
||||
hash = "sha256-MwEisPJdzZN1VRnssotvExNMYOQdffS+Y2B8ZSUDVfo=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "c-cube";
|
||||
repo = "linol";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-G/5nTJd+MxPgNObKW2Hmmwn4HejQ81c3f4oVXjpNSZg=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
yojson
|
||||
logs
|
||||
(lsp.override { version = "1.18.0"; })
|
||||
ppx_yojson_conv_lib
|
||||
trace
|
||||
uutf
|
||||
yojson
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "LSP server library";
|
||||
license = licenses.mit;
|
||||
maintainers = [ maintainers.ulrikstrid ];
|
||||
homepage = "https://github.com/c-cube/linol";
|
||||
changelog = "https://raw.githubusercontent.com/c-cube/linol/refs/tags/v${version}/CHANGES.md";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [
|
||||
stepbrobd
|
||||
ulrikstrid
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
21
pkgs/development/ocaml-modules/linol/eio.nix
Normal file
21
pkgs/development/ocaml-modules/linol/eio.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
buildDunePackage,
|
||||
eio,
|
||||
linol,
|
||||
yojson,
|
||||
}:
|
||||
|
||||
buildDunePackage {
|
||||
pname = "linol-eio";
|
||||
inherit (linol) version src;
|
||||
|
||||
propagatedBuildInputs = [
|
||||
eio
|
||||
linol
|
||||
yojson
|
||||
];
|
||||
|
||||
meta = linol.meta // {
|
||||
description = "LSP server library (with Eio for concurrency)";
|
||||
};
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
{
|
||||
buildDunePackage,
|
||||
linol,
|
||||
jsonrpc,
|
||||
lwt,
|
||||
yojson,
|
||||
}:
|
||||
@ -12,7 +11,6 @@ buildDunePackage {
|
||||
|
||||
propagatedBuildInputs = [
|
||||
linol
|
||||
jsonrpc
|
||||
lwt
|
||||
yojson
|
||||
];
|
||||
|
||||
@ -1042,6 +1042,8 @@ let
|
||||
|
||||
linol = callPackage ../development/ocaml-modules/linol { };
|
||||
|
||||
linol-eio = callPackage ../development/ocaml-modules/linol/eio.nix { };
|
||||
|
||||
linol-lwt = callPackage ../development/ocaml-modules/linol/lwt.nix { };
|
||||
|
||||
llvm = callPackage ../development/ocaml-modules/llvm {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user