1diff --git i/src/lsp/diagnostic.ml w/src/lsp/diagnostic.ml
2index 149cde11..bd93298a 100644
3--- i/src/lsp/diagnostic.ml
4+++ w/src/lsp/diagnostic.ml
5@@ -1,13 +1,12 @@
6-
7 (* This file is free software, part of dolmen. See file "LICENSE" for more information *)
8
9-type t = Lsp.Types.Diagnostic.t
10+type t = Linol__.Common_.Lsp.Types.Diagnostic.t
11
12 let lsp_pos line character =
13- Lsp.Types.Position.create ~line ~character
14+ Linol__.Common_.Lsp.Types.Position.create ~line ~character
15
16 let lsp_range start end_ =
17- Lsp.Types.Range.create ~start ~end_
18+ Linol__.Common_.Lsp.Types.Range.create ~start ~end_
19
20 let start_pos = lsp_pos 1 1
21 let start_range = lsp_range start_pos start_pos
22@@ -23,17 +22,15 @@ let range_of_loc = function
23 (lsp_pos (l.stop_line - 1) l.stop_column)
24
25 let warn ?loc message =
26- Lsp.Types.Diagnostic.create ()
27+ Linol__.Common_.Lsp.Types.Diagnostic.create ()
28 ~range:(range_of_loc loc)
29 ~severity:Warning
30 ~source:"dolmenls"
31 ~message
32
33 let error ?loc message =
34- Lsp.Types.Diagnostic.create ()
35+ Linol__.Common_.Lsp.Types.Diagnostic.create ()
36 ~range:(range_of_loc loc)
37 ~severity:Error
38 ~source:"dolmenls"
39 ~message
40-
41-
42diff --git i/src/lsp/main.ml w/src/lsp/main.ml
43index 8d6fc760..b52dd25c 100644
44--- i/src/lsp/main.ml
45+++ w/src/lsp/main.ml
46@@ -3,7 +3,7 @@
47
48 let run () =
49 let s = new Server.dolmen_lsp_server in
50- let server = Linol_lwt.Jsonrpc2.create_stdio s in
51+ let server = Linol_lwt.Jsonrpc2.create_stdio ~env:() s in
52 let task = Linol_lwt.Jsonrpc2.run server in
53 match Linol_lwt.run task with
54 | () -> ()
55diff --git i/src/lsp/server.ml w/src/lsp/server.ml
56index e895cc6a..a01ed9fb 100644
57--- i/src/lsp/server.ml
58+++ w/src/lsp/server.ml
59@@ -44,25 +44,28 @@ class dolmen_lsp_server =
60 object(self)
61 inherit Linol_lwt.Jsonrpc2.server
62
63+ method spawn_query_handler f = Linol_lwt.spawn f
64+
65 (* one env per document *)
66- val buffers: (Lsp.Types.DocumentUri.t, State.t) Hashtbl.t = Hashtbl.create 32
67+ val buffers: (Linol__.Common_.Lsp.Types.DocumentUri.t, State.t) Hashtbl.t = Hashtbl.create 32
68
69 (* A list of include statements of the prelude files *)
70 val mutable prelude = []
71
72 method! config_sync_opts =
73 (* configure how sync happens *)
74- let change = Lsp.Types.TextDocumentSyncKind.Incremental in
75- (* Lsp.Types.TextDocumentSyncKind.Full *)
76- Lsp.Types.TextDocumentSyncOptions.create ~openClose:true ~change
77- ~save:(Lsp.Types.SaveOptions.create ~includeText:false ())
78+ let change = Linol__.Common_.Lsp.Types.TextDocumentSyncKind.Incremental in
79+ (* Linol__.Common_.Lsp.Types.TextDocumentSyncKind.Full *)
80+ Linol__.Common_.Lsp.Types.TextDocumentSyncOptions.create ~openClose:true ~change
81+ ~save:(`SaveOptions (Linol__.Common_.Lsp.Types.SaveOptions.create ~includeText:false ()))
82 ()
83
84 method private _on_doc
85 ~(notify_back:Linol_lwt.Jsonrpc2.notify_back)
86- (uri:Lsp.Types.DocumentUri.t) (contents:string) =
87+ (uri:Linol__.Common_.Lsp.Types.DocumentUri.t) (contents:string) =
88 (* TODO: unescape uri/translate it to a correct path ? *)
89- match Loop.process prelude (preprocess_uri uri) (Some contents) with
90+ let uri_path = Linol__.Common_.Lsp.Uri.to_path uri in
91+ match Loop.process prelude (preprocess_uri uri_path) (Some contents) with
92 | Ok state ->
93 let diags = State.get State.diagnostics state in
94 Hashtbl.replace buffers uri state;
95@@ -79,9 +82,9 @@ class dolmen_lsp_server =
96 self#_on_doc ~notify_back d.uri new_content
97
98 method! on_notification_unhandled
99- ~notify_back:_ (n:Lsp.Client_notification.t) =
100+ ~notify_back:_ (n:Linol__.Common_.Lsp.Client_notification.t) =
101 match n with
102- | Lsp.Client_notification.ChangeConfiguration { settings; } ->
103+ | Linol__.Common_.Lsp.Client_notification.ChangeConfiguration { settings; } ->
104 begin try
105 prelude <- mk_prelude (parse_settings settings);
106 Linol_lwt.Jsonrpc2.IO.return ()
107@@ -89,7 +92,7 @@ class dolmen_lsp_server =
108 Linol_lwt.Jsonrpc2.IO.failwith s
109 end
110 | _ ->
111- Lwt.return ()
112+ Linol_lwt.Jsonrpc2.IO.return ()
113
114 method on_notif_doc_did_close ~notify_back d =
115 Hashtbl.remove buffers d.uri;
116diff --git i/src/lsp/state.ml w/src/lsp/state.ml
117index f3e89640..3f8a36ab 100644
118--- i/src/lsp/state.ml
119+++ w/src/lsp/state.ml
120@@ -45,7 +45,7 @@ let warn ?file:_ ?loc t warn payload =
121 in
122 Format.kfprintf (fun _ ->
123 let msg = Format.flush_str_formatter () in
124- let d = Diagnostic.warn ~loc msg in
125+ let d = Diagnostic.warn ~loc (`String msg) in
126 add_diag d t) Format.str_formatter "%a"
127 Dolmen_loop.Report.Warning.print (warn, payload)
128
129@@ -67,7 +67,7 @@ let error ?file:_ ?loc t err payload =
130 (* Print the error message *)
131 Format.kfprintf (fun _ ->
132 let msg = Format.flush_str_formatter () in
133- let d = Diagnostic.error ~loc msg in
134+ let d = Diagnostic.error ~loc (`String msg) in
135 add_diag d t) Format.str_formatter "%a"
136 Dolmen_loop.Report.Error.print (err, payload)
137