From 09529a0d45dece24f75a74fe11ed50f8479f5c59 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 13 Apr 2022 21:15:06 -0400 Subject: [PATCH 1/6] carry done/partialProgress tokens around --- src/server.ml | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/server.ml b/src/server.ml index 649f9355..412ec299 100644 --- a/src/server.ml +++ b/src/server.ml @@ -165,12 +165,13 @@ module Make(IO : IO) = struct IO.return @@ InitializeResult.create ~capabilities () (** Called when the user hovers on some identifier in the document *) - method on_req_hover ~notify_back:_ ~id:_ ~uri:_ ~pos:_ + method on_req_hover ~notify_back:_ ~id:_ ~uri:_ ~pos:_ ~workDoneToken:_ (_ : doc_state) : Hover.t option IO.t = IO.return None (** Called when the user requests completion in the document *) method on_req_completion ~notify_back:_ ~id:_ ~uri:_ ~pos:_ ~ctx:_ + ~workDoneToken:_ ~partialResultToken:_ (_ : doc_state) : [ `CompletionList of CompletionList.t | `List of CompletionItem.t list ] option IO.t = @@ -178,36 +179,41 @@ module Make(IO : IO) = struct (** Called when the user wants to jump-to-definition *) method on_req_definition ~notify_back:_ ~id:_ ~uri:_ ~pos:_ + ~workDoneToken:_ ~partialResultToken:_ (_ : doc_state) : Locations.t option IO.t = IO.return None (** List code lenses for the given document @since 0.3 *) method on_req_code_lens ~notify_back:_ ~id:_ ~uri:_ + ~workDoneToken:_ ~partialResultToken:_ (_ : doc_state) : CodeLens.t list IO.t = IO.return [] (** Code lens resolution, must return a code lens with non null "command" @since 0.3 *) method on_req_code_lens_resolve - ~notify_back:(_:notify_back) ~id:_ (cl:CodeLens.t) : CodeLens.t IO.t = + ~notify_back:(_:notify_back) ~id:_ + (cl:CodeLens.t) : CodeLens.t IO.t = IO.return cl (** Code action. @since 0.3 *) - method on_req_code_action ~notify_back:(_:notify_back) ~id:_ (_c:CodeActionParams.t) + method on_req_code_action ~notify_back:(_:notify_back) ~id:_ + (_c:CodeActionParams.t) : CodeActionResult.t IO.t = IO.return None (** Execute a command with given arguments. @since 0.3 *) - method on_req_execute_command ~notify_back:_ ~id:_ + method on_req_execute_command ~notify_back:_ ~id:_ ~workDoneToken:_ (_c:string) (_args:Yojson.Safe.t list option) : Yojson.Safe.t IO.t = IO.return `Null (** List symbols in this document. @since 0.3 *) method on_req_symbol ~notify_back:_ ~id:_ ~uri:_ + ~workDoneToken:_ ~partialResultToken:_ () : [ `DocumentSymbol of DocumentSymbol.t list | `SymbolInformation of SymbolInformation.t list ] option IO.t = IO.return None @@ -227,7 +233,7 @@ module Make(IO : IO) = struct let notify_back = new notify_back ~notify_back () in self#on_req_initialize ~notify_back i - | Lsp.Client_request.TextDocumentHover { textDocument; position } -> + | Lsp.Client_request.TextDocumentHover { textDocument; position; workDoneToken } -> let uri = textDocument.uri in Log.debug (fun k->k "req: hover '%s'" (DocumentUri.to_path uri)); @@ -235,10 +241,12 @@ module Make(IO : IO) = struct | None -> IO.return None | Some doc_st -> let notify_back = new notify_back ~uri ~notify_back () in - self#on_req_hover ~notify_back ~id ~uri ~pos:position doc_st + self#on_req_hover ~notify_back ~id ~uri ~pos:position ~workDoneToken doc_st end - | Lsp.Client_request.TextDocumentCompletion { textDocument; position; context } -> + | Lsp.Client_request.TextDocumentCompletion { + textDocument; position; context; workDoneToken; partialResultToken; + } -> let uri = textDocument.uri in Log.debug (fun k->k "req: complete '%s'" (DocumentUri.to_path uri)); begin match Hashtbl.find_opt docs uri with @@ -246,9 +254,12 @@ module Make(IO : IO) = struct | Some doc_st -> let notify_back = new notify_back ~uri ~notify_back () in self#on_req_completion ~notify_back ~id ~uri + ~workDoneToken ~partialResultToken ~pos:position ~ctx:context doc_st end - | Lsp.Client_request.TextDocumentDefinition { textDocument; position } -> + | Lsp.Client_request.TextDocumentDefinition { + textDocument; position; workDoneToken; partialResultToken; + } -> let uri = textDocument.uri in Log.debug (fun k->k "req: definition '%s'" (DocumentUri.to_path uri)); let notify_back = new notify_back ~uri ~notify_back () in @@ -257,10 +268,13 @@ module Make(IO : IO) = struct | None -> IO.return None | Some doc_st -> self#on_req_definition ~notify_back ~id + ~workDoneToken ~partialResultToken ~uri ~pos:position doc_st end - | Lsp.Client_request.TextDocumentCodeLens {textDocument} -> + | Lsp.Client_request.TextDocumentCodeLens { + textDocument; workDoneToken; partialResultToken; + } -> let uri = textDocument.uri in Log.debug (fun k->k "req: codelens '%s'" (DocumentUri.to_path uri)); let notify_back = new notify_back ~uri ~notify_back () in @@ -268,7 +282,8 @@ module Make(IO : IO) = struct begin match Hashtbl.find_opt docs uri with | None -> IO.return [] | Some doc_st -> - self#on_req_code_lens ~notify_back ~id ~uri doc_st + self#on_req_code_lens ~notify_back ~id ~uri + ~workDoneToken ~partialResultToken doc_st end | Lsp.Client_request.TextDocumentCodeLensResolve cl -> @@ -276,14 +291,15 @@ module Make(IO : IO) = struct let notify_back = new notify_back ~notify_back () in self#on_req_code_lens_resolve ~notify_back ~id cl - | Lsp.Client_request.ExecuteCommand { command; arguments } -> + | Lsp.Client_request.ExecuteCommand { command; arguments; workDoneToken } -> Log.debug (fun k->k "req: execute command '%s'" command); let notify_back = new notify_back ~notify_back () in - self#on_req_execute_command ~notify_back ~id command arguments + self#on_req_execute_command ~notify_back ~id ~workDoneToken command arguments - | Lsp.Client_request.DocumentSymbol { textDocument=d } -> + | Lsp.Client_request.DocumentSymbol { textDocument=d; workDoneToken; partialResultToken } -> let notify_back = new notify_back ~notify_back () in - self#on_req_symbol ~notify_back ~id ~uri:d.uri () + self#on_req_symbol ~notify_back ~id ~uri:d.uri + ~workDoneToken ~partialResultToken () | Lsp.Client_request.CodeAction a -> let notify_back = new notify_back ~notify_back () in From 38341a60d32d32c9a6c41d8662b099d621da3a4c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 13 Apr 2022 21:19:28 -0400 Subject: [PATCH 2/6] chore: CI: disable macOS --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aa33ed93..9dd5a339 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: - - macos-latest + #- macos-latest - ubuntu-latest - windows-latest ocaml-compiler: From a42204d7e02eb335a74ae5304fa1f5bed23335bc Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 13 Apr 2022 21:27:38 -0400 Subject: [PATCH 3/6] ci --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9dd5a339..79f33a65 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,9 +12,9 @@ jobs: strategy: matrix: os: - #- macos-latest - ubuntu-latest - - windows-latest + #- macos-latest + #- windows-latest ocaml-compiler: - 4.08.x - 4.12.x From 04e54490eaef6cfe75f9915fa7a1d9f38b350dd2 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 18 Apr 2022 00:42:44 -0400 Subject: [PATCH 4/6] chore: CI --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79f33a65..1c253980 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: - 4.12.x runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@main - uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: ${{ matrix.ocaml-compiler }} From 774f6b8de516ee62570f0487728763ed944cbf5c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 24 Apr 2022 20:53:26 -0400 Subject: [PATCH 5/6] move to OCaml 4.12 minimum --- .github/workflows/main.yml | 2 +- linol.opam | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c253980..acb12b71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,8 +16,8 @@ jobs: #- macos-latest #- windows-latest ocaml-compiler: - - 4.08.x - 4.12.x + - 4.14.x runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@main diff --git a/linol.opam b/linol.opam index 40a0b381..69428b12 100644 --- a/linol.opam +++ b/linol.opam @@ -15,7 +15,7 @@ depends: [ "yojson" { >= "1.6" } "logs" "lsp" { >= "1.8" & < "1.11" } - "ocaml" { >= "4.08" } + "ocaml" { >= "4.12" } "odoc" { with-doc } ] tags: [ "lsp" "server" "lwt" ] From dd64f55c42c65f3b8821848d90a31b564e142860 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 1 May 2022 10:07:59 -0400 Subject: [PATCH 6/6] ci --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index acb12b71..1139c297 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,7 @@ name: build on: push: - branches: - - master pull_request: - branches: - - master jobs: run: name: Build