-
Notifications
You must be signed in to change notification settings - Fork 121
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
Implement textDocument/formatting #89
Conversation
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.
Looks good, but let's get rid of all the things used to configure ocamlformat. Ocamlformat should read its own configuration by reading the .ocamlformat file (or otherwise choose a default) config.
OK, I'll remove those config stuffs. |
We will have to set |
Looking good. In this PR, we still need to add:
|
Ok, but where the convention is documented? |
Nowhere 😭 Once I switch to generated code, I will document the convention more thoroughly. For now, the simple rule is: any identifier from the LSP spec should maintain its casing. Otherwise, we should stick to the OCaml convention of |
5913c47
to
efe2672
Compare
rebased. |
@rgrinberg I revert efe2672. Stdune's |
This reverts commit efe2672.
I guess we should add |
09bef36
to
f0083ea
Compare
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
I pushed a commit that handles errors a little better notifies the user if the ocamlformat binary is missing. |
This PR implements
textDocument/formatting
with a wrapper module toocamlformat
.It finds
ocamlformat
from the current PATH and runs it at the current directoryocamllsp
is running. Note that I didn't add any facility to find the nearest.ocamlformat
.textDocument/{rangeFormatting, onTypeFormatting}
is not yet implemented. Once ocaml-ppx/ocamlformat#1188 comes into reality, we can easily extend this implementation to support them.