Skip to content

Commit 89f9f64

Browse files
committed
ocamlformat 0.27.0
1 parent 6c26560 commit 89f9f64

File tree

262 files changed

+1836
-2358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+1836
-2358
lines changed

.ocamlformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
profile = default
2-
version = 0.26.2
2+
version = 0.27.0
33

44
field-space = tight-decl
55
break-cases = toplevel

analysis/reanalyze/src/DeadCommon.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,8 @@ module Decl = struct
555555
let refIsBelow (pos : Lexing.position) =
556556
decl.pos.pos_fname <> pos.pos_fname
557557
|| decl.pos.pos_cnum < pos.pos_cnum
558-
&& (* not a function defined inside a function, e.g. not a callback *)
558+
&&
559+
(* not a function defined inside a function, e.g. not a callback *)
559560
decl.posEnd.pos_cnum < pos.pos_cnum
560561
in
561562
refs |> PosSet.exists refIsBelow

analysis/reanalyze/src/Paths.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ module Config = struct
110110
| None -> ())
111111
end
112112

113-
(**
114-
* Handle namespaces in cmt files.
115-
* E.g. src/Module-Project.cmt becomes src/Module
116-
*)
113+
(** * Handle namespaces in cmt files. * E.g. src/Module-Project.cmt becomes
114+
src/Module *)
117115
let handleNamespace cmt =
118116
let cutAfterDash s =
119117
match String.index s '-' with

analysis/src/CompletionJsx.ml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,15 @@ type jsxProps = {
286286
childrenStart: (int * int) option;
287287
}
288288

289-
(**
290-
<div muted= />
289+
(** <div muted= />
291290
292-
This is a special case for JSX props, where the above code is parsed
293-
as <div muted=//, a regexp literal. We leverage that fact to trigger completion
294-
for the JSX prop value.
291+
This is a special case for JSX props, where the above code is parsed as <div
292+
muted=//, a regexp literal. We leverage that fact to trigger completion for
293+
the JSX prop value.
295294
296-
This code is safe because we also check that the location of the expression is broken,
297-
which only happens when the expression is a parse error/not complete.
298-
*)
295+
This code is safe because we also check that the location of the expression
296+
is broken, which only happens when the expression is a parse error/not
297+
complete. *)
299298
let isRegexpJsxHeuristicExpr expr =
300299
match expr.Parsetree.pexp_desc with
301300
| Pexp_extension

analysis/src/Loc.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ let toString (loc : t) =
99

1010
let hasPos ~pos loc = start loc <= pos && pos < end_ loc
1111

12-
(** Allows the character after the end to be included. Ie when the cursor is at the
13-
end of the word, like `someIdentifier<cursor>`. Useful in some scenarios. *)
12+
(** Allows the character after the end to be included. Ie when the cursor is at
13+
the end of the word, like `someIdentifier<cursor>`. Useful in some
14+
scenarios. *)
1415
let hasPosInclusiveEnd ~pos loc = start loc <= pos && pos <= end_ loc
1516

1617
let mkPosition (pos : Pos.t) =

analysis/src/References.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ let definedForLoc ~file ~package locKind =
209209
maybeLog "Yes!! got it";
210210
Some res)))
211211

212-
(** Find alternative declaration: from res in case of interface, or from resi in case of implementation *)
212+
(** Find alternative declaration: from res in case of interface, or from resi in
213+
case of implementation *)
213214
let alternateDeclared ~(file : File.t) ~package (declared : _ Declared.t) tip =
214215
match Hashtbl.find_opt package.pathsForModule file.moduleName with
215216
| None -> None

analysis/src/SharedTypes.ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ and completionType =
356356
fields: field list;
357357
definition:
358358
[ `NameOnly of string
359-
(** When we only have the name, like when pulling the record from a declared type. *)
359+
(** When we only have the name, like when pulling the record from a
360+
declared type. *)
360361
| `TypeExpr of Types.type_expr
361362
(** When we have the full type expr from the compiler. *) ];
362363
}
@@ -573,7 +574,8 @@ module Completable = struct
573574
(** Additional context for nested completion where needed. *)
574575
type nestedContext =
575576
| RecordField of {seenFields: string list}
576-
(** Completing for a record field, and we already saw the following fields... *)
577+
(** Completing for a record field, and we already saw the following
578+
fields... *)
577579
| CameFromRecordField of string
578580
(** We just came from this field (we leverage use this for better
579581
completion names etc) *)
@@ -656,11 +658,13 @@ module Completable = struct
656658
| CdecoratorPayload of decoratorPayload
657659
| CextensionNode of string (** e.g. %todo *)
658660
| CnamedArg of contextPath * string * string list
659-
(** e.g. (..., "label", ["l1", "l2"]) for ...(...~l1...~l2...~label...) *)
661+
(** e.g. (..., "label", ["l1", "l2"]) for ...(...~l1...~l2...~label...)
662+
*)
660663
| Cnone (** e.g. don't complete inside strings *)
661664
| Cpath of contextPath
662665
| Cjsx of string list * string * string list
663-
(** E.g. (["M", "Comp"], "id", ["id1", "id2"]) for <M.Comp id1=... id2=... ... id *)
666+
(** E.g. (["M", "Comp"], "id", ["id1", "id2"]) for <M.Comp id1=...
667+
id2=... ... id *)
664668
| Cexpression of {
665669
contextPath: contextPath;
666670
nested: nestedPath list;

analysis/src/SignatureHelp.ml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -553,44 +553,44 @@ let signatureHelp ~path ~pos ~currentFile ~debug ~allowForConstructorPayloads =
553553
let offset = ref 0 in
554554
Some
555555
(`InlineRecord
556-
(fields
557-
|> List.map (fun (field : field) ->
558-
let startOffset = !offset in
559-
let argText =
560-
Printf.sprintf "%s%s: %s" field.fname.txt
561-
(if field.optional then "?" else "")
562-
(Shared.typeToString
563-
(if field.optional then
564-
Utils.unwrapIfOption field.typ
565-
else field.typ))
566-
in
567-
let endOffset =
568-
startOffset + String.length argText
569-
in
570-
offset := endOffset + String.length ", ";
571-
(argText, field, (startOffset, endOffset)))))
556+
(fields
557+
|> List.map (fun (field : field) ->
558+
let startOffset = !offset in
559+
let argText =
560+
Printf.sprintf "%s%s: %s" field.fname.txt
561+
(if field.optional then "?" else "")
562+
(Shared.typeToString
563+
(if field.optional then
564+
Utils.unwrapIfOption field.typ
565+
else field.typ))
566+
in
567+
let endOffset =
568+
startOffset + String.length argText
569+
in
570+
offset := endOffset + String.length ", ";
571+
(argText, field, (startOffset, endOffset)))))
572572
| Args [(typ, _)] ->
573573
Some
574574
(`SingleArg
575-
( typ |> Shared.typeToString,
576-
docsForLabel ~file:full.file ~package:full.package
577-
~supportsMarkdownLinks typ ))
575+
( typ |> Shared.typeToString,
576+
docsForLabel ~file:full.file ~package:full.package
577+
~supportsMarkdownLinks typ ))
578578
| Args args ->
579579
let offset = ref 0 in
580580
Some
581581
(`TupleArg
582-
(args
583-
|> List.map (fun (typ, _) ->
584-
let startOffset = !offset in
585-
let argText = typ |> Shared.typeToString in
586-
let endOffset =
587-
startOffset + String.length argText
588-
in
589-
offset := endOffset + String.length ", ";
590-
( argText,
591-
docsForLabel ~file:full.file ~package:full.package
592-
~supportsMarkdownLinks typ,
593-
(startOffset, endOffset) ))))
582+
(args
583+
|> List.map (fun (typ, _) ->
584+
let startOffset = !offset in
585+
let argText = typ |> Shared.typeToString in
586+
let endOffset =
587+
startOffset + String.length argText
588+
in
589+
offset := endOffset + String.length ", ";
590+
( argText,
591+
docsForLabel ~file:full.file ~package:full.package
592+
~supportsMarkdownLinks typ,
593+
(startOffset, endOffset) ))))
594594
in
595595
let label =
596596
constructor.name ^ "("

analysis/src/TypeUtils.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,10 +1165,11 @@ let transformCompletionToPipeCompletion ?(synthetic = false) ~env ?posOfDot
11651165
| Some posOfDot -> Some (makeAdditionalTextEditsForRemovingDot posOfDot));
11661166
}
11671167

1168-
(** This takes a type expr and the env that type expr was found in, and produces a globally unique
1169-
id for that specific type. The globally unique id is the full path to the type as seen from the root
1170-
of the project. Example: type x in module SomeModule in file SomeFile would get the globally
1171-
unique id `SomeFile.SomeModule.x`.*)
1168+
(** This takes a type expr and the env that type expr was found in, and produces
1169+
a globally unique id for that specific type. The globally unique id is the
1170+
full path to the type as seen from the root of the project. Example: type x
1171+
in module SomeModule in file SomeFile would get the globally unique id
1172+
`SomeFile.SomeModule.x`.*)
11721173
let rec findRootTypeId ~full ~env (t : Types.type_expr) =
11731174
let debug = false in
11741175
match t.desc with

analysis/src/Utils.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
(**
2-
* `startsWith(string, prefix)`
3-
* true if the string starts with the prefix
4-
*)
1+
(** * `startsWith(string, prefix)` * true if the string starts with the prefix
2+
*)
53
let startsWith s prefix =
64
if prefix = "" then true
75
else

0 commit comments

Comments
 (0)