Open eaubin opened 4 years ago
I think we could do something similar to the C++ Extension's ClangFormat setting:
So file
would read from .ocamlformat
in the workspace, or you could choose {conventional|default|compact|sparse|ocamlformat|janestreet}
for a certain ocamlformat profile that would be used with --enable-outside-detected-project
. This would require more integration with the language server. @rgrinberg - what do you think?
There was another snag adding a trivial .ocamlformat file version=0.15.0 but omitting a newline. Formatting didn't work, or produce any error output.
I couldn't reproduce this on both my Windows and macOS computers. Is this something that happens every time?
My newline observation must have not been the cause (or fix) of my problem. I couldn't reproduce it this morning. It might have been the case that the file was simply not saved when I thought it was.
This would require more integration with the language server. @rgrinberg - what do you think?
Sounds alright to me.
I also was confused by the no-op reformatting, glad for this issue reminding me that my current project happened to not have an .ocamlformat
file.
Hi everyone !
I'm a teacher in a french CPGE, where OCaml is part of the curriculum but managing projects with dune or other build systems is not an objective (as well as understanding how VSCode workspaces work). We often rely on opening a single file to work in, changing workspaces and readding a .ocamlformat
file each time to the workspace root is not something easy to do with 24-48 students (with a significant part with no CS or even programming experience).
So
file
would read from.ocamlformat
in the workspace, or you could choose{conventional|default|compact|sparse|ocamlformat|janestreet}
for a certain ocamlformat profile that would be used with--enable-outside-detected-project
. This would require more integration with the language server. @rgrinberg - what do you think?
This would be a great thing as configuring this on a fleet of CS lab machines would be easy. Another solution would be to change the behavior of the extension outside of a dune project, such that a format action could use the enable-outside-detected-project
option, letting the students use their own format style and providing a default with a .ocamlformat
file in the ~/.config
folder which is also easy to configure and to tweak to our needs.
Let me know what you think.
I had some problems getting formatting to work when trying vscode-ocaml-platform for the first time. The comment by @mnxn on r/ocaml the other day was helpful.
Would it be possible to not require an .ocamlformat file or add that requirement to the README?
There was another snag adding a trivial .ocamlformat file
version=0.15.0
but omitting a newline. Formatting didn't work, or produce any error output.