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

Column formatting #415

Closed
sarmong opened this issue Mar 21, 2022 · 3 comments
Closed

Column formatting #415

sarmong opened this issue Mar 21, 2022 · 3 comments

Comments

@sarmong
Copy link

sarmong commented Mar 21, 2022

Is it possible to format (or at least keep the formatting) in a column structure?

Here's what I mean (the spaces will shrink after formatting)
image

It is something that e.g. shfmt does.

@JohnnyMorganz
Copy link
Owner

Alignment is something I'm somewhat interested in looking at, and it was also suggested in another position in #252, but there are a few reasons why it can be an issue:

  1. aligning causes a lot of diff noise (if something forces the alignment to change, then all other comments get changed unnecessarily)
  2. it is difficult to calculate alignment nicely (i havent looked into this fully yet). It would probably be a two-pass formatting, where we first format normally then align comments afterwards.

If alignment was to be added, it would most likely be behind an option due to issue (1), as diff noise is not wanted by a lot of people.

@sarmong
Copy link
Author

sarmong commented Mar 21, 2022

Behind an option would be great as well!

Also, maybe it is possible to do alignment only if there are 2+ spaces in any of the lines inside one codeblock? And if every line has only one space - don't align.

@JohnnyMorganz
Copy link
Owner

Going to fold this in as a duplicate of #252 for now, as it seems to be the same idea of aligning trailing comments

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

2 participants