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

Preview ocamlformat 0.27.0 preview1 #1227

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ c5b7900eb40a48e2877db4994a2b2f8d755531e4
1cf80035f66badcc8b4e667cbfd13cb483a7a773
# Upgrade to OCamlformat 0.26.1
1c015488b8d32a0571eaa144a92ab4725bad0b85
# Upgrade to OCamlformat 0.27.0-preview1
99333b9df5e71b17b58e50432d34bbea035a9fcf
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module-item-spacing=preserve
version=0.26.1
version=0.27.0-preview1
ocaml-version=4.02
13 changes: 8 additions & 5 deletions doc/examples/expansion.mli
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(** Examples of different features of Expansion *)

(** For details on what each of the following examples is showing,
see the explanations in the {{!page-features}Features page} *)
(** For details on what each of the following examples is showing, see the
explanations in the {{!page-features} Features page} *)

[@@@warning "-67"]
module Simple : sig
Expand All @@ -23,7 +23,8 @@ module Aliases : sig
end

module ModuleTypeAliases : sig
(** Demonstrates that module types are not expanded if they're a simple path to another. *)
(** Demonstrates that module types are not expanded if they're a simple path
to another. *)

module type A = sig
type t
Expand Down Expand Up @@ -125,7 +126,8 @@ module DeepEquality : sig
end

module DeepEquality2 : sig
(** Demonstrates expansion involving an equation on a type in a submodule, but the submodule is already a simple signature *)
(** Demonstrates expansion involving an equation on a type in a submodule, but
the submodule is already a simple signature *)

module type MODTYPE = sig
module X : sig
Expand Down Expand Up @@ -172,7 +174,8 @@ module ModuleTypeOf : sig
end

module ModuleTypeOfComplications : sig
(** Demonstrates the interaction of [module type of] and destructive module substitution *)
(** Demonstrates the interaction of [module type of] and destructive module
substitution *)

module type S = sig
module X : sig
Expand Down
97 changes: 48 additions & 49 deletions doc/examples/markup.mli
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
(** Markup examples. *)

(** The OCaml manual gives a
{{:https://ocaml.org/manual/ocamldoc.html#ss:ocamldoc-placement}comprehensive example}
of comment placement. This has been replicated in the module Foo below to
show how this is rendered by [odoc]. *)
{{:https://ocaml.org/manual/ocamldoc.html#ss:ocamldoc-placement}
comprehensive example} of comment placement. This has been replicated in
the module Foo below to show how this is rendered by [odoc]. *)

module type Foo = sig
(** The first special comment of the file is the comment associated
with the whole module.*)
(** The first special comment of the file is the comment associated with the
whole module.*)

(** Special comments can be placed between elements and are kept
by the OCamldoc tool, but are not associated to any element.
[@]-tags in these comments are ignored.*)
(** Special comments can be placed between elements and are kept by the
OCamldoc tool, but are not associated to any element. [@]-tags in these
comments are ignored.*)

(*******************************************************************)
(** Comments like the one above, with more than two asterisks,
are ignored. *)
(** Comments like the one above, with more than two asterisks, are ignored. *)

(** The comment for function f. *)
val f : int -> int -> int
(** The continuation of the comment for function f. *)

(* Hello, I'm a simple comment :-) *)
exception My_exception of (int -> int) * int
(** Comment for exception My_exception, even with a simple comment
between the special comment and the exception.*)
(** Comment for exception My_exception, even with a simple comment between the
special comment and the exception.*)

(** Comment for type weather *)
(** Comment for type weather *)
type weather =
| Rain of int (** The comment for constructor Rain *)
| Sun (** The comment for constructor Sun *)

(** Comment for type weather2 *)
(** Comment for type weather2 *)
type weather2 =
| Rain of int (** The comment for constructor Rain *)
| Sun (** The comment for constructor Sun *)
(** I can continue the comment for type weather2 here
because there is already a comment associated to the last constructor.*)
(** I can continue the comment for type weather2 here because there is already
a comment associated to the last constructor.*)

(** The comment for type my_record *)
type my_record = {
Expand Down Expand Up @@ -67,9 +66,8 @@ module type Foo = sig
val toto : int
(** The comment for attribute toto. *)

(** This comment is not attached to titi since
there is a blank line before titi, but is kept
as a comment in the class. *)
(** This comment is not attached to titi since there is a blank line before
titi, but is kept as a comment in the class. *)

val titi : string

Expand Down Expand Up @@ -126,8 +124,8 @@ module Stop : sig
end

val foo : string
(** This value appears in the documentation, since the Stop special comment
in the class does not affect the parent module of the class.*)
(** This value appears in the documentation, since the Stop special comment in
the class does not affect the parent module of the class.*)

(**/**)

Expand All @@ -137,14 +135,14 @@ module Stop : sig
(**/**)

type t = string
(** The type t appears since in the documentation since the previous stop comment
toggled off the "no documentation mode". *)
(** The type t appears since in the documentation since the previous stop
comment toggled off the "no documentation mode". *)
end

(** {2 Scoping rules} *)
module Scope : sig
(** In this floating comment I can refer to type {!t} and value {!v}
declared later in the signature *)
(** In this floating comment I can refer to type {!t} and value {!v} declared
later in the signature *)

type t

Expand All @@ -155,12 +153,12 @@ module Scope : sig
val y : int

module A : sig
(** In this module I can refer to val {!x} declared above as well as
type {!u} declared later in the parent module. Elements declared
in this signature take priority, so {!y} refers to {!A.y} as
opposed to the [y] declared in the parent signature.
@see 'markup.mli' for a good time *)
(** In this module I can refer to val {!x} declared above as well as type
{!u} declared later in the parent module. Elements declared in this
signature take priority, so {!y} refers to {!A.y} as opposed to the [y]
declared in the parent signature.

@see 'markup.mli' for a good time *)

val y : string
end
Expand All @@ -174,25 +172,27 @@ module Preamble_examples : sig
(** This is the comment attached to the declaration of Hidden__Module *)
module Hidden__Module : sig
(** This is the top comment declared in the module Hidden__module.
This is the second paragraph in the module Hidden__module.
@canonical Odoc_examples.Markup.Module *)

This is the second paragraph in the module Hidden__module.

@canonical Odoc_examples.Markup.Module *)

type t
(** This is a comment on type t *)
end

module Module = Hidden__Module
(** This comment is on the declaration of Module as an alias of Hidden__Module *)
(** This comment is on the declaration of Module as an alias of Hidden__Module
*)

(** This is the comment attached to the declaration of module Hidden__Module2 *)
(** This is the comment attached to the declaration of module Hidden__Module2
*)
module Hidden__Module2 : sig
(** This is the top comment declared in the module Hidden__module2.
This is the second paragraph in the module Hidden__module2.
@canonical Odoc_examples.Markup.Module2 *)

This is the second paragraph in the module Hidden__module2.

@canonical Odoc_examples.Markup.Module2 *)

type t
(** This is a comment on type t *)
Expand All @@ -202,23 +202,22 @@ module Preamble_examples : sig

module Nonhidden_module : sig
(** This is the top comment declared in the module Hidden__module2.

This is the second paragraph in the module Hidden__module2.
*)

This is the second paragraph in the module Hidden__module2. *)
end

module Module3 = Nonhidden_module
(** This comment is on the declaration of Module3 as an alias of Nonhidden_module *)
(** This comment is on the declaration of Module3 as an alias of
Nonhidden_module *)

module Nonhidden_module2 : sig
(** This is the top comment declared in the module Hidden__module2.

This is the second paragraph in the module Hidden__module2.
*)

This is the second paragraph in the module Hidden__module2. *)
end

module Module4 = Nonhidden_module2

(** The [modules] special reference can be used to refer to a list of modules.
It uses the synopsis from the modules *)
It uses the synopsis from the modules *)
end
4 changes: 2 additions & 2 deletions doc/examples/odoc_examples.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(** Examples of the output from [odoc] *)

(** These examples are intended to be viewed alongside the
source code. See {:https://github.com/ocaml/odoc/tree/master/doc/examples} *)
(** These examples are intended to be viewed alongside the source code. See
{:https://github.com/ocaml/odoc/tree/master/doc/examples} *)

module Expansion = Expansion
module Resolution = Resolution
Expand Down
13 changes: 7 additions & 6 deletions doc/examples/resolution.mli
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(** Examples of Path, Fragment and Reference Resolution *)

(** This module contains examples of some of the features of Resolution
as described in the page {!page-features}. See the explanations there for
details on what each of these demonstrates. *)
(** This module contains examples of some of the features of Resolution as
described in the page {!page-features}. See the explanations there for
details on what each of these demonstrates. *)

[@@@warning "-67"]

Expand All @@ -28,7 +28,7 @@ end

module HiddenAlias : sig
(** Demonstrates a reference to an item in a module that's an alias of a
hidden module. *)
hidden module. *)

(**/**)

Expand Down Expand Up @@ -110,8 +110,9 @@ module References : sig
end
end

(** We can refer unambiguously to {!module-type-A.t} in module type [A] or {!module-A.t} in module [A],
and also where there are name clashes within the path: {!module-A.module-B.t} or {!module-A.module-type-B.t} *)
(** We can refer unambiguously to {!module-type-A.t} in module type [A] or
{!module-A.t} in module [A], and also where there are name clashes within
the path: {!module-A.module-B.t} or {!module-A.module-type-B.t} *)
end

module Complicated_1 : sig
Expand Down
4 changes: 3 additions & 1 deletion src/document/comment.ml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ module Reference = struct
| Some s -> s
and tooltip =
(* Add a tooltip if the content is not the rendered reference. *)
match text with None -> None | Some _ -> Some rendered
match text with
| None -> None
| Some _ -> Some rendered
in
match Url.from_identifier ~stop_before:false id with
| Ok url ->
Expand Down
4 changes: 2 additions & 2 deletions src/document/doctree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ end
module Headings : sig
val fold :
enter_subpages:bool -> ('a -> Heading.t -> 'a) -> 'a -> Page.t -> 'a
(** Fold over every headings, follow nested documentedsrc and
expansions, as well as subpages if [enter_subpages] is [true]. *)
(** Fold over every headings, follow nested documentedsrc and expansions, as
well as subpages if [enter_subpages] is [true]. *)

val foldmap :
enter_subpages:bool ->
Expand Down
18 changes: 9 additions & 9 deletions src/document/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,10 @@ module Make (Syntax : SYNTAX) = struct
intro @ variants @ ending

let format_params :
'row.
?delim:[ `parens | `brackets ] ->
Odoc_model.Lang.TypeDecl.param list ->
text =
'row.
?delim:[ `parens | `brackets ] ->
Odoc_model.Lang.TypeDecl.param list ->
text =
fun ?(delim = `parens) params ->
let format_param { Odoc_model.Lang.TypeDecl.desc; variance; injectivity }
=
Expand Down Expand Up @@ -808,11 +808,11 @@ module Make (Syntax : SYNTAX) = struct
++ O.box_hv_no_indent (type_expr t2)))

let format_manifest :
'inner_row 'outer_row.
?is_substitution:bool ->
?compact_variants:bool ->
Odoc_model.Lang.TypeDecl.Equation.t ->
text * bool =
'inner_row 'outer_row.
?is_substitution:bool ->
?compact_variants:bool ->
Odoc_model.Lang.TypeDecl.Equation.t ->
text * bool =
fun ?(is_substitution = false) ?(compact_variants = true) equation ->
let _ = compact_variants in
(* TODO *)
Expand Down
3 changes: 1 addition & 2 deletions src/document/generator_signatures.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ type rendered_item = DocumentedSrc.t

type text = Codefmt.t

(** HTML generation syntax customization module. See {!ML} and
{!Reason}. *)
(** HTML generation syntax customization module. See {!ML} and {!Reason}. *)
module type SYNTAX = sig
module Obj : sig
val close_tag_closed : string
Expand Down
10 changes: 4 additions & 6 deletions src/document/targets.mli
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
(** Collect all the urls of pages defined by a model.

Roughly a simplified version of the normal process
to convert a model into a document, only for extracting Urls.
Used to determine the build targets.
*)
(** Collect all the urls of pages defined by a model.

Roughly a simplified version of the normal process to convert a model into a
document, only for extracting Urls. Used to determine the build targets. *)

open Odoc_model.Lang

Expand Down
Loading
Loading