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

Bug?: --enable-outside-detected-project does not use global configuration in projects without .ocamlformat #2509

Open
lentil32 opened this issue Jan 13, 2024 · 1 comment

Comments

@lentil32
Copy link

lentil32 commented Jan 13, 2024

Describe the bug

When dune-project exists and project-wise .ocamlformat does not exist, unconfigured default foramtting will be used. (macOS)

Expected Behavior
Use global configuration if it is a project directory and no .ocamlformat file exist. Or, add --auto-adopt-global-config-when-local-absent option.

How to Reproduce

$XDG_CONFIG_HOME/ocamlformat:

profile=janestreet # 'default', 'janestreet', ...

In project directories, i.e., with dune-project file, or even in directories that is not OCaml project but .git exists,

$ ocamlformat --enable-outside-detected-project --print-config
...
space-around-variants=true
stritem-extension-indent=0
type-decl=compact
type-decl-indent=2
wrap-comments=false
wrap-fun-args=true
profile=default

Not in project directories,

$ ocamlformat --enable-outside-detected-project --print-config
...
type-decl-indent=2 (profile janestreet (file ../../.config/ocamlformat:1))
wrap-comments=false (profile janestreet (file ../../.config/ocamlformat:1))
wrap-fun-args=false (profile janestreet (file ../../.config/ocamlformat:1))
profile=janestreet (file ../../.config/ocamlformat:1)

See also

@lentil32 lentil32 changed the title Bug?: --enable-outside-detected-project does not use global configuration in projects Bug?: --enable-outside-detected-project does not use global configuration in projects without .ocamlformat Jan 13, 2024
@Julow
Copy link
Collaborator

Julow commented Jan 16, 2024

I agree that ocamlformat should use the global configuration when --enable-outside-detected-project and a project is detected but has no configuration.

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

No branches or pull requests

2 participants