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

Change default indentation to 2 spaces #87

Closed
alygin opened this issue Sep 8, 2019 · 4 comments
Closed

Change default indentation to 2 spaces #87

alygin opened this issue Sep 8, 2019 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@alygin
Copy link
Contributor

alygin commented Sep 8, 2019

At the moment, the default setting for the code formatter is 4 spaces. I'd like to change it to 2 spaces for TLA+, PlusCal and .cfg-files, but not sure yet.

4 spaces:

  • the default setting in the Toolbox
  • the default setting in most of the text editors

2 spaces:

  • used in pretty all the TLA+ examples / books / tutorials
  • feels more suitable to me, since
    • TLA+ code is usually indented in accordance with /\'s, \/'s and other operators or syntax constructions, so pure tabs are rare
    • PlusCal code is usually not very convoluted, and 2 spaces indentation seems enough to easily navigate its structure
    • .cfg files are even simpler
  • IDEs and text editors now provide many tools for dealing with code structure (indentation guide lines, folding, current block highlighting etc.) that doing all this with long spaces seems redundant.

Any input on the issue is welcomed.

@alygin alygin added enhancement New feature or request help wanted Extra attention is needed labels Sep 8, 2019
@alygin alygin added this to the v1.0.0 milestone Sep 8, 2019
@alygin alygin mentioned this issue Sep 8, 2019
@suhr
Copy link

suhr commented Sep 9, 2019

Four spaces identation is more visible in the generated pdf. Also, it aligns nicely with LET:

ReplaceNode(table, id, new) ==
    LET bs  == table.buckets
        k   == CHOOSE k \in 0..Len(bs): id \in {n.id : n \in bs[k]}
        old == CHOOSE old \in bs[k]: old.id = id
    IN
        [table EXCEPT !.buckets[k] = (bs[k] \ {old}) \cup {new}]

@alygin
Copy link
Contributor Author

alygin commented Sep 10, 2019

One more opinion: #67 (comment)

@alygin
Copy link
Contributor Author

alygin commented Sep 11, 2019

BTW, here's an instruction on how to change the formatting style: Formatting Preferences.

@alygin
Copy link
Contributor Author

alygin commented Sep 15, 2019

It looks like having 4 spaces by default + documentation on how to change preferences is safe choice.

@alygin alygin closed this as completed Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

2 participants