Skip to content

Feature request: Support #use toplevel directives in .ml files #1011

@Wilfred

Description

@Wilfred

Is your feature request related to a problem? Please describe.
It would be really useful if ocamlformat could handle files with #use "foo.ml" in them.

#523 mentions that shebangs #!/usr/bin/env ocaml and #require "Foo" are supported, and #731 mentions some others, but #use currently isn't supported.

#use "bar.ml"
$ ocamlformat --enable-outside-detected-project ~/tmp/foo.ml
ocamlformat: ignoring "/Users/wilfred/tmp/foo.ml" (syntax error)
File "/Users/wilfred/tmp/foo.ml", line 1, characters 0-1:
Error: Syntax error

Describe the solution you'd like
Format files with `#use "foo.ml" in them. I don't think ocamlformat needs to anything with the directive, but it would be nice if it processed the rest of the file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions