Skip to content
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

Formatting cinaps comments #924

Closed
ghost opened this issue Jul 15, 2019 · 2 comments · Fixed by #934
Closed

Formatting cinaps comments #924

ghost opened this issue Jul 15, 2019 · 2 comments · Fixed by #934
Assignees

Comments

@ghost
Copy link

ghost commented Jul 15, 2019

The cinaps tool recognises special comments with OCaml code inside them. I wanted to check what the ocamlformat team thought of adding knowledge of the cinaps syntax in ocamlformat so that the code inside such comment could be automatically formatted?

More precisely, cinaps recognises the following two syntaxes:

  • (*$ <ocaml-code> *)
  • (*$ <ocaml-code> $*)

For instance:

(*$ for i = 1 to 3 do Printf.printf "let x%d = %d\n" i i; done *)
let x1 = 1
let x2 = 2
let x3 = 3
(*$*)

To give a bit more context, we use this tool at Jane Street as a principled way of generating and committing parts of ml files. Its use has grown quite a lot since it was introduced a couple of years ago. It's now integrated in Dune via the cinaps stanza and used in a couple of open source projects outside of Jane Street, though Idon't know how much cinaps is used in the wild at the moment.

@gpetiot
Copy link
Collaborator

gpetiot commented Jul 22, 2019

I guess this is similar to formatting the code in docstrings (#478) so we will probably look into these 2 issues at the same time.

@ghost
Copy link
Author

ghost commented Jul 23, 2019

Makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant