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

Option to align a comment's opening and closing stars #312

Open
mjambon opened this issue Dec 1, 2020 · 0 comments
Open

Option to align a comment's opening and closing stars #312

mjambon opened this issue Dec 1, 2020 · 0 comments

Comments

@mjambon
Copy link

mjambon commented Dec 1, 2020

I didn't find an option to align the stars of closing comments. It's intended for comments that use a star at the beginning of each line, like this:

(* hello
 * world
 *)

The closing delimiter currently gets indented as follows by ocp-indent, which looks bad:

(* hello
 * world
*)

This happens regardless the strict_comments setting.

Option 1

I propose adding a setting for aligning the opening star with the closing star when the closing delimiter is on its own line. This would be done independently of what the comment contains. It would produce this:

(* hello
 * world
 *)

(*
 * hello
 * world
 *)

(* hello
   world
 *)

(*
   hello
   world
 *)

(* hello world *)

(* hello
   world *)

Option 2

Alternatively, if it's easy enough, we could only align the closing star if all the lines of the comment start with a star. This could be done by default without a special setting, and assume the old behavior is a bug. It would give this:

(* hello
 *)

(*
   hello
*)

(*
 * hello
 *)

(*
 * hello
 * world
 *)

(*
   hello:
     * world
     * other
*)

Does it seem like a reasonable thing to add? Option 2 seems nicer for the user, being all automatic and accommodating multiple styles.

@mjambon mjambon changed the title Option to align the comment's opening and closing stars Option to align a comment's opening and closing stars Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant