Commit graph

146 commits

Author SHA1 Message Date
Simon Cruanes
7730eabf98
fix workflow 2024-02-20 13:13:08 -05:00
Simon Cruanes
9a1dc8fd9a
gh pages 2024-02-20 13:00:34 -05:00
Simon Cruanes
6d2d6a8f40
udpate @since tags 2024-02-20 13:00:34 -05:00
Vincent Laporte
630a6226bc Drop redundant dependency on atomic
The linol library already depends on OCaml ≥ 4.14
2024-02-17 11:33:01 -05:00
Simon Cruanes
68525aa24b
prepare for 0.5 2024-02-15 15:33:12 -05:00
Simon Cruanes
c19cb0ba8e
Merge pull request #27 from c-cube/wip-lsp.1.16
undefined
2024-02-15 15:27:47 -05:00
Simon Cruanes
1bada18e18
fix CI 2024-02-15 15:03:09 -05:00
Simon Cruanes
74e0a4d7c0
opam 2024-02-15 15:01:41 -05:00
Simon Cruanes
10b6e950d0
CI 2024-02-15 14:50:54 -05:00
Simon Cruanes
9eb9514401
update to lsp 1.17 2024-02-15 14:43:55 -05:00
Simon Cruanes
10bea1e417 small fix 2024-02-15 14:25:59 -05:00
Simon Cruanes
1f4337cda2 more tracing 2024-02-15 14:25:59 -05:00
Simon Cruanes
fa2900d8e5 feat: add trace and atomic to trace blocking IOs 2024-02-15 14:25:59 -05:00
Simon Cruanes
3fffe00a39 fast CI 2024-02-15 14:25:59 -05:00
Simon Cruanes
dda10ad74b fix: run some parts of notification handling sequentially 2024-02-15 14:25:59 -05:00
Xavier Denis
af49b048c9 Add handlers for unknown requests and notifications 2023-10-20 09:51:37 -04:00
Simon Cruanes
498c62d46f add functions in jsonrpc2 to send queries/notifs directly from server 2023-10-20 09:50:33 -04:00
Anton Sorokin
bb92d7d73b [#24] Expose get_uri for notify_back
Problem:
As in #24, it's impossible to extract `uri`  variable from
`notify_back`, but sometimes we want to do this

Solution:
Add `method get_uri = uri` to notify_back
2023-08-08 12:24:04 -04:00
Simon Cruanes
e50388a3be
expose logs_src 2023-08-04 16:41:16 -04:00
Simon Cruanes
09f2f9a1b2
expose log source 2023-08-04 16:34:56 -04:00
Anton Sorokin
09311ae258 [#22] Threat shutdown and exit requests correctly
Problem:
As in [#22], we want to shut down our LSP server correctly.
That means we should close the pipe and end process after an exit request.
This require proper `shutdown : unit -> bool` function passed
to `Jsonrpc2.Make.run` which returns `true` after
the server received an exit request.

Right now both exit and shutdown requests are setting
LSP server's internal var `_quit` to true. It's very intuitive to
use this var in `shutdown`, but we can't do it, since in this case
the server would stop receiving new messages right after the
shutdown request, despite the fact  according to the LSP specification
it had to wait the exit request.

Solution:
Instead of `_quit : bool` use
```
status : [ `Running | `ReceivedShutdown | `ReceivedExit ]
```
and suggest
```
shutdown () = s#get_status = `ReceivedExit
```
in docs for `Jsonrpc2.Make.run` and in the templete/example.
2023-08-04 09:31:23 -04:00
Simon Cruanes
c6969ab87c
api break: put spawn in the server itself, not IO 2023-08-02 14:25:07 -04:00
Simon Cruanes
8c2e204cdf
Merge pull request #21 from serokell/Sorokin-Anton/handle-null-in-params
[#20] Handle messages with null value for  "params" field
2023-07-10 10:53:18 -04:00
Anton Sorokin
8c4ca80411
[#20] Handle messages with null value for "params" field
Problem:
If an LSP client sends a request with "params":null instead
of omitting the params field or smth like "params":{},
decoding error appears.

Solution:
Replace `null` value for "params" to `{}`
2023-07-10 15:54:36 +03:00
Simon Cruanes
35e89143c4
basic docstrings 2023-04-01 21:48:40 -04:00
Simon Cruanes
439534e0c5
Merge pull request #18 from serokell/heitor-lassarote/handle-server-requests-lsp-1.14
Handle server requests
2023-03-16 11:18:04 -04:00
Heitor Toledo Lassarote de Paula
8857d5e7c5
Add a comment to send_server_req
Problem: There is an invariant that must be satisfied to call that
function.

Solution: Describe it to warn users of jsonrpc2.
2023-03-15 12:02:02 -03:00
Heitor Toledo Lassarote de Paula
431f3ea126
Disable batch processing
Problem: There was a misunderstanding when implementing this: batch
processing should not return responses individually, but rather return a
list with batch responses. This will require some further logic to group
such responses in order to process them in sequence.

Solution: We return those methods to being unhandled.
2023-03-14 15:27:32 -03:00
Simon Cruanes
1a300c0de9
Merge pull request #17 from c-cube/wip-lsp-1.14
move to lsp 1.14
2023-03-14 14:02:02 -04:00
Heitor Toledo Lassarote de Paula
5388f58530
Handle server requests
Problem: Linol can only send notifications from the server to the
client, but not requests.

Solution: The solution was inspired by Haskell's `lsp` package. We first
maintain a `server_request_handler_pair` data structure which represents
some server request and its associated response handler. Now
`notify_back` may take these fields and use it to actually handle a
request and its response. Changes to `notify_back` are propagated
throughout `server.ml`.

On `jsonrpc2.ml`, we refactor the notification and request handlers so
that we may handle the response and batch response handlers and batch
call as a courtesy. For a response, we keep a hash table that tracks an
ID to the `server_request_handler_pair` in other to be able to call the
handler that was associated with the response. After we get such
response (indexed by the server request's ID), we remove it from the
hash table to prevent a memory leak.

Since the server needs to keep track of the server request IDs, I added
a mutable `id_counter` in order to generate a fresh LSP ID (using
`fresh_lsp_id`) for every outgoing request.

For debugging, if we error while decoding a JSON, I now print the
exception too.
2023-03-14 14:46:46 -03:00
Simon Cruanes
d418ea010a
opam 2023-03-11 00:05:04 -05:00
Simon Cruanes
fbdc432829
refactor: handle workDoneTokens 2023-03-10 23:54:06 -05:00
Simon Cruanes
e9cc94dc14
autoformat 2023-03-10 23:12:41 -05:00
Simon Cruanes
341b9919dc
add ocamlformat 2023-03-10 23:12:29 -05:00
Simon Cruanes
8cbe2b3519
move to lsp 1.14 2023-03-10 23:12:13 -05:00
Simon Cruanes
db3fde45f3
gitignore 2023-03-10 22:44:11 -05:00
Simon Cruanes
5a29a9e145
Merge pull request #15 from xldenis/master
Update LSP to v1.11.*
2022-05-04 13:38:45 -04:00
Simon Cruanes
be92297c27
Merge branch 'master' into master 2022-05-04 12:26:01 -04:00
Simon Cruanes
dd64f55c42
ci 2022-05-01 10:07:59 -04:00
Xavier Denis
e9db2fd331 Update to lsp 1.11.* to enable unknown notifications 2022-05-01 13:27:05 +02:00
Simon Cruanes
774f6b8de5
move to OCaml 4.12 minimum 2022-04-24 20:53:26 -04:00
Simon Cruanes
04e54490ea
chore: CI 2022-04-18 00:42:44 -04:00
Simon Cruanes
a42204d7e0
ci 2022-04-13 21:27:38 -04:00
Simon Cruanes
38341a60d3
chore: CI: disable macOS 2022-04-13 21:19:28 -04:00
Simon Cruanes
09529a0d45
carry done/partialProgress tokens around 2022-04-13 21:17:31 -04:00
Simon Cruanes
01824dd17e
Merge pull request #14 from xldenis/master
Update linol to latest lsp
2022-04-13 21:14:59 -04:00
Xavier Denis
fe5fdb8a79 Update linol to latest lsp 2022-04-13 13:02:46 +02:00
Simon Cruanes
3e42640335
fix: better options for config sync opts 2021-11-21 23:04:48 -05:00
Simon Cruanes
066577c4db chore: update CI to github actions 2 2021-07-30 12:42:56 -04:00
Simon Cruanes
70222b0395 prepare for 0.4 2021-07-30 12:25:42 -04:00