-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide ocamlformat-rpc through the ocamlformat package #2035
Conversation
"alcotest" {with-test} | ||
"ocamlformat" {= version} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dune file still lists ocamlformat
as a library dependency. Where would that dependency come from if this package is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because #2022 renamed ocamlformat_lib to ocamlformat, but this dependency was always here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was necessary. Both the library and the binary are part of the ocamlformat
package, Dune won't build if it isn't installed first:
$ dune build -p ocamlformat-rpc-lib,ocamlformat-rpc
File "lib-rpc-server/dune", line 4, characters 12-23:
4 | (libraries ocamlformat ocamlformat-rpc-lib))
^^^^^^^^^^^
Error: Library "ocamlformat" not found.
For this to work, the library should be moved to its own package.
What about building the RPC server as part of the main package ? This way people can forget about whether they want the RPC or the binary and just have both.
This would also improve the UX with ocaml-lsp. The fact that you need to install both ocamlformat and ocamlformat-rpc as a dependency is a little awkward. |
Is this what you had in mind? I'm just worried about the .mld file I had to rename to avoid having 2 index.mld in a single package, I hope it will properly show up in the v3 online documentation. |
It doesn't build because now the
This dependency was useful to be sure the encoder/decoder functions are in sync but is not fundamentally required and brings a lot of dangerous code into the server impl. It should be possible to copy the few needed functions into the server instead. The documentation doesn't work because there's no link to it from the |
Would it be such a bad thing to add a dependency to ocamlformat-rpc-lib in ocamlformat instead of duplicating code? |
I think it's not that much duplication, given that this dependency doesn't make much sense in the first place. The rpc-lib API doesn't make sense for a server and is here just to share a few decode functions (that don't need to be shared anyway). |
I think if makes sense to avoid duplicating the whole |
Here's a way to remove the dependency but still share the serialization/deserialization code: gpetiot#12 |
* lib-rpc: Split "protocol" and "client" The Protocol module defines the serializing and deserializing code for commands. The main Make functor now only defines the client API. Command types are no longer exposed, the Client API is more focused. * Remove dependency between main package and lib-rpc Define a library from copied modules from the lib-rpc library. These two modules are present in both library. * Remove unecessary template file * rpc: Fix the doc Link to the new page and move it to the doc directory.
@Julow thanks, I agree with your changes! @rgrinberg @ulugbekna @tmattio @panglesd let us know if everything is alright for you then we can merge. |
Looks good to me! |
I won't be able to review, sorry. But from my perspective, if it's possible to use the rpc lib without depending on anything else, it's enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the API changes to lib-rpc are not an issue, this can be merged.
CHANGES: ### Removed - Profiles `compact` and `sparse` are now removed (ocaml-ppx/ocamlformat#2075, @gpetiot) - Options `align-cases`, `align-constructors-decl` and `align-variants-decl` are now removed (ocaml-ppx/ocamlformat#2076, @gpetiot) - Option `disable-outside-detected-project` is now removed (ocaml-ppx/ocamlformat#2077, @gpetiot) ### Deprecated - Cancel the deprecations of options that are not set by the preset profiles (ocaml-ppx/ocamlformat#2074, @gpetiot) ### Bug fixes - emacs: Remove temp files in the event of an error (ocaml-ppx/ocamlformat#2003, @gpetiot) - Fix unstable comment formatting around prefix op (ocaml-ppx/ocamlformat#2046, @gpetiot) ### Changes - Qtest comments are not re-formatted (ocaml-ppx/ocamlformat#2034, @gpetiot) - ocamlformat-rpc is now distributed through the ocamlformat package (ocaml-ppx/ocamlformat#2035, @Julow) - Doc-comments code blocks with a language other than 'ocaml' (set in metadata) are not parsed as OCaml (ocaml-ppx/ocamlformat#2037, @gpetiot) - More comprehensible error message in case of version mismatch (ocaml-ppx/ocamlformat#2042, @gpetiot) - The global configuration file (`$XDG_CONFIG_HOME` or `$HOME/.config`) is only applied when no project is detected, `--enable-outside-detected-project` is set, and no applicable `.ocamlformat` file has been found. Global and local configurations are no longer used at the same time. (ocaml-ppx/ocamlformat#2039, @gpetiot) - Set `ocaml-version` to a fixed version (4.04.0) by default to avoid reproducibility issues and surprising behaviours (ocaml-ppx/ocamlformat#2064, @kit-ty-kate) - Split option `--numeric=X-Y` into `--range=X-Y` and `--numeric` (flag). For now `--range` can only be used with `--numeric`. (ocaml-ppx/ocamlformat#2073, ocaml-ppx/ocamlformat#2082, @gpetiot) ### New features - New syntax `(*= ... *)` for verbatim comments (ocaml-ppx/ocamlformat#2028, @gpetiot) - Preserve the begin-end construction in the AST (ocaml-ppx/ocamlformat#1785, @hhugo, @gpetiot) - Preserve position of comments located after the semi-colon of the last element of lists/arrays/records (ocaml-ppx/ocamlformat#2032, @gpetiot) - Option `--print-config` displays a warning when an .ocamlformat file defines redundant options (already defined by a profile) (ocaml-ppx/ocamlformat#2084, @gpetiot)
Reverts some bits of #2022
cc @rgrinberg
cc @tmattio since you opened #2022