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

Lack of vertical spacing in the output #32

Open
tpwo opened this issue Aug 17, 2021 · 1 comment
Open

Lack of vertical spacing in the output #32

tpwo opened this issue Aug 17, 2021 · 1 comment

Comments

@tpwo
Copy link
Contributor

tpwo commented Aug 17, 2021

I think that vertical spacing is an important factor when talking about legibility of the code.

And I noticed that the current formatting completely removes every blank line, which makes some files hard to read, as the code is blended together.

My solution to this would be adding a blank line after every semicolon. This is a simple rule, but seems to make a big difference at first glance. There are at least two exceptions, though:

  • Do not insert a blank line after line with within statement (as it looks a bit strange to have a blank line there. I need to check, but I think that Dymola would remove such blank line after saving a file).

  • Do not insert a blank line after semicolons that are part of matrix notation (as having a blank line there would rather decrease readability).

    So this should be the desired output for matrices:

    parameter Integer[2,2] A = [
      1,2;
      3,4];

I've managed to find a way to achieve it, see PR #31

However, the current solution has one bug: it leaves two blank lines at the end of files that end with a semicolon.

I am also not sure about my approach, maybe there's a better way to achieve this output.

And also, what do you think about this idea? Maybe you strip the blank lines because of some concrete reason?

@macintoshpie
Copy link
Contributor

I think you are right, having blank lines makes it much more legible. There wasn't really a reason why we remove all whitespace currently.

Thanks for the PR! I'll take a look at it soon when I get some time on my hands 😄

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