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
Simon Cruanes
0a26367afb
fix opam file for linol-lwt
2021-06-01 19:48:20 -04:00
Simon Cruanes
995d0defa2
diable debug msg that sometimes fails
2021-06-01 18:46:30 -04:00
Simon Cruanes
8ec409dda0
fix compilation
2021-06-01 18:37:54 -04:00
Simon Cruanes
754ecac307
some logging
2021-06-01 18:36:49 -04:00
Simon Cruanes
8e37c17733
add config completion
2021-06-01 18:36:49 -04:00
Simon Cruanes
ec6d0412b7
remove containers as a dep; fix opam
2021-06-01 18:36:49 -04:00
Simon Cruanes
4988316f9d
prepare for 0.3
2021-05-05 13:44:09 -04:00
Simon Cruanes
7dd2ce0cd0
reexpose Req_id
2021-04-23 16:41:50 -04:00
Simon Cruanes
1668e9938a
feat: add ~id param to all queries
2021-04-23 16:21:48 -04:00
Simon Cruanes
13feb606d2
feat(blockingIO): allow to change the spawn function
2021-04-21 17:41:43 -04:00
Simon Cruanes
e77fded638
relax constraints on lsp
2021-04-15 15:41:21 -04:00
Simon Cruanes
2a3c815a08
fix warning
2021-04-14 22:39:07 -04:00
Simon Cruanes
149ab8464e
Merge branch 'wip-ci'
2021-04-14 10:52:01 -04:00
Simon Cruanes
38c85ce5ca
config for documentSymbolProvider
2021-04-13 15:30:03 -04:00
Simon Cruanes
97bbdfd4ba
feat: expose on_req_symbol
2021-04-13 15:27:42 -04:00
Simon Cruanes
5ac3931310
chore: ci for linol
2021-04-09 16:27:12 -04:00
Simon Cruanes
34f931e74c
feat: more config methods
2021-04-09 14:57:36 -04:00
Simon Cruanes
8cec4089dd
try to handle documentChange for unknown doc
2021-04-08 20:53:54 -04:00
Simon Cruanes
c417204f1e
fix: debug message was making lsp crash
2021-04-08 20:30:36 -04:00
Simon Cruanes
11c4f36d02
more debug info
2021-04-08 20:21:45 -04:00
Simon Cruanes
1710df0e7e
use logs to log stuff
2021-04-08 19:52:35 -04:00
Simon Cruanes
0808ecefbe
fix: avoid exception prone Hashtbl.find
2021-04-08 19:34:03 -04:00
Simon Cruanes
b7e89f67e4
try to print backtraces when handlers fail
2021-04-08 19:28:49 -04:00
Simon Cruanes
e5cb0a331b
feat: allow to set the URI in notify_back
2021-04-08 14:00:45 -04:00
Simon Cruanes
d5b0159aa9
allow server to list commands
2021-04-07 18:53:01 -04:00
Simon Cruanes
3fac121a48
fix type for on_notification_unhandled
2021-04-07 18:06:18 -04:00
Simon Cruanes
6d9d2e51e3
refactor: give notify_back to requests, too
2021-04-07 18:01:37 -04:00
Simon Cruanes
e8af605985
feat: provide on_req_execute_command
2021-04-07 16:38:28 -04:00
Simon Cruanes
47da02e18c
methods for codelens handling
2021-04-07 16:14:30 -04:00