Skip to content

Conversation

gridbugs
Copy link
Collaborator

Fixes #12311

@gridbugs gridbugs requested a review from ElectreAAS August 26, 2025 07:33
File "dune-project", line 1, characters 0-0:
Error: Invalid first line, expected: (lang <lang> <version>)

Hint: You may want to verify the following depexts are installed:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be updated too with the new line?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yes but I haven't figured out how to express this with Pp. The algorithm that Pp uses for formatting breaks lines in such a way that it breaks between Hint: and the message depending on the length of the message. In this case it splits if the concatenation of all depext names is longer than some threshold even though the depext names are in a vbox so their total width shouldn't matter (only their maximum width).

It might be a bug in Pp though I don't completely understand Pp.

File "dune-project", line 1, characters 0-0:
Error: Invalid first line, expected: (lang <lang> <version>)

Hint: You may want to verify the following depexts are installed:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be updated too with the new line?

@gridbugs gridbugs force-pushed the fix-gh12311 branch 2 times, most recently from 782f417 to c0041b6 Compare August 27, 2025 06:07
[ Pp.textf "You may want to verify the following depexts are installed:"
; Pp.enumerate ~f:Pp.verbatim depexts
]
|> Pp.concat_map ~sep:Pp.cut ~f:(fun pp -> Pp.box pp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ~f:Fun.id and you should put Pp.hovbox on the first line and Pp.vbox on the second. Then you should do a Pp.vbox after concatenating. I think this will give you what you want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you mean:

let depexts_hint = function
  | [] -> None
  | depexts ->
    [ Pp.hovbox @@ Pp.textf "You may want to verify the following depexts are installed:"
    ; Pp.vbox @@ Pp.enumerate ~f:Pp.verbatim depexts
    ]
    |> Pp.concat_map ~sep:Pp.cut ~f:Fun.id
    |> Pp.vbox
    |> Option.some
;;

I tried that and it had the same behaviour as the current state of this PR.

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

Labels

None yet

Projects

None yet

3 participants