|
| 1 | +diff --git a/src/lsp/main.ml b/src/lsp/main.ml |
| 2 | +index 8d6fc760..b52dd25c 100644 |
| 3 | +--- a/src/lsp/main.ml |
| 4 | ++++ b/src/lsp/main.ml |
| 5 | +@@ -3,7 +3,7 @@ |
| 6 | + |
| 7 | + let run () = |
| 8 | + let s = new Server.dolmen_lsp_server in |
| 9 | +- let server = Linol_lwt.Jsonrpc2.create_stdio s in |
| 10 | ++ let server = Linol_lwt.Jsonrpc2.create_stdio ~env:() s in |
| 11 | + let task = Linol_lwt.Jsonrpc2.run server in |
| 12 | + match Linol_lwt.run task with |
| 13 | + | () -> () |
| 14 | +diff --git a/src/lsp/server.ml b/src/lsp/server.ml |
| 15 | +index e895cc6a..c9a3f237 100644 |
| 16 | +--- a/src/lsp/server.ml |
| 17 | ++++ b/src/lsp/server.ml |
| 18 | +@@ -44,6 +44,8 @@ class dolmen_lsp_server = |
| 19 | + object(self) |
| 20 | + inherit Linol_lwt.Jsonrpc2.server |
| 21 | + |
| 22 | ++ method spawn_query_handler _ = () |
| 23 | ++ |
| 24 | + (* one env per document *) |
| 25 | + val buffers: (Lsp.Types.DocumentUri.t, State.t) Hashtbl.t = Hashtbl.create 32 |
| 26 | + |
| 27 | +@@ -55,14 +57,14 @@ class dolmen_lsp_server = |
| 28 | + let change = Lsp.Types.TextDocumentSyncKind.Incremental in |
| 29 | + (* Lsp.Types.TextDocumentSyncKind.Full *) |
| 30 | + Lsp.Types.TextDocumentSyncOptions.create ~openClose:true ~change |
| 31 | +- ~save:(Lsp.Types.SaveOptions.create ~includeText:false ()) |
| 32 | ++ ~save:(`SaveOptions (Lsp.Types.SaveOptions.create ~includeText:false ())) |
| 33 | + () |
| 34 | + |
| 35 | + method private _on_doc |
| 36 | + ~(notify_back:Linol_lwt.Jsonrpc2.notify_back) |
| 37 | + (uri:Lsp.Types.DocumentUri.t) (contents:string) = |
| 38 | + (* TODO: unescape uri/translate it to a correct path ? *) |
| 39 | +- match Loop.process prelude (preprocess_uri uri) (Some contents) with |
| 40 | ++ match Loop.process prelude (preprocess_uri (Lsp.Types.DocumentUri.to_string uri)) (Some contents) with |
| 41 | + | Ok state -> |
| 42 | + let diags = State.get State.diagnostics state in |
| 43 | + Hashtbl.replace buffers uri state; |
0 commit comments