Skip to content

Expose a RPC interface through a new binary ocamlformat-rpc and a new library ocamlformat-rpc-lib#1586

Merged
gpetiot merged 9 commits intoocaml-ppx:masterfrom
gpetiot:rpc
Mar 18, 2021
Merged

Expose a RPC interface through a new binary ocamlformat-rpc and a new library ocamlformat-rpc-lib#1586
gpetiot merged 9 commits intoocaml-ppx:masterfrom
gpetiot:rpc

Conversation

@gpetiot
Copy link
Copy Markdown
Collaborator

@gpetiot gpetiot commented Jan 12, 2021

cc @emillon @voodoos @rgrinberg

The current state of this PR is:

We define a new binary ocamlformat-rpc that starts a listening loop, accepting the following commands from stdin:

  • halt
  • format-type T, the formatted type would be printed on stdout
  • invalid requests do nothing
    So far the version is not part of the protocol, but we can imagine that the client specifies it when initiating the connection with the server, and the server could return ACK/NACK or propose another version.

@rgrinberg
Copy link
Copy Markdown
Contributor

So far the version is not part of the protocol, but we can imagine that the client specifies it when initiating the connection with the server, and the server could return ACK/NACK or propose another version.

That seems like a good idea. Is the rpc library going to be public?

@gpetiot
Copy link
Copy Markdown
Collaborator Author

gpetiot commented Jan 26, 2021

That seems like a good idea. Is the rpc library going to be public?

Yes I guess we can release this lib as a new ocamlformat-rpc-lib package.

@gpetiot gpetiot marked this pull request as ready for review February 10, 2021 12:29
@gpetiot gpetiot changed the title Rpc mode Expose a RPC interface through a new binary ocamlformat-rpc and a new library ocamlformat-rpc-lib Feb 10, 2021
@gpetiot gpetiot requested review from Julow and emillon February 17, 2021 17:32
@gpetiot
Copy link
Copy Markdown
Collaborator Author

gpetiot commented Mar 1, 2021

This PR fulfills the needs of ocaml-lsp (@voodoos) and mdx (@NathanReb), @emillon @Julow do you have some comments on it before I release it for 0.17.1 ?

@gpetiot
Copy link
Copy Markdown
Collaborator Author

gpetiot commented Mar 10, 2021

I tried several APIs for ocamlformat-rpc-lib but I'm not satisfied with what we've got (I tried moving the client in the exposed api so that the users don't have to define it but types escape their scope everywhere, not sure I'm on the right track), if you have some ideas for improvements I'm open to it @emillon @rgrinberg
cc @voodoos

@gpetiot gpetiot merged commit 585b139 into ocaml-ppx:master Mar 18, 2021
@gpetiot gpetiot deleted the rpc branch March 18, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants