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

Define indent size in editorconfig #550

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

GeckoEidechse
Copy link
Member

@GeckoEidechse GeckoEidechse commented Sep 14, 2023

Setting indent size in .editorconfig means that things like GitHub web preview will default to showing tab indent size as 4 spaces.

By default GitHub uses tabsize 8 for indentation making diffs look weird (cause clang-format is doing wrong things)
image

See also https://stackoverflow.com/questions/8833953/how-to-change-tab-size-on-github

Setting indent size in `.editorconfig` means that things like GitHub web
preview will default to showing tab indent size as 4 spaces.
@GeckoEidechse
Copy link
Member Author

As a sidenote, I just found out that clang-format does tab indentation incorrectly, so enjoy this rant copy-pasted from Discord:

holy fuck, not even clang-format does tab indentation correctly
Like, as far as I have been told, the whole reason why some people (who are clearly wrong) prefer tabs is cause you can set your tab size to whatever you prefer be it, 2, 3 (omfg why?!), 4, 8 (spotted the old school C dev) etc
and still have the code aligned
right?

And yet, tab indentation is still done incorrectly
Like look at this
image
the correct way to indent lines 32 and 33 would be to use one tab (like line 31) and then do the rest with spaces so that the aligned stays correct with the line above which has characters on it. That way changing tab size does not fuck the formatting
But guess what...
image
Even fucking clang-format used tabs here
So for tab size 4 it's perfectly fine
But the moment you change it

tab size == 2
image
tab size == 8
image

boom, it's all fucked
defeating the entire purpose of using tabs in the first place

Anyway, so this is why spaces are the only correct way of indentation. Cause these fuck-ups will never happen.

@ASpoonPlaysGames ASpoonPlaysGames added the needs code review Changes from PR still need to be reviewed in code label Sep 16, 2023
@ASpoonPlaysGames
Copy link
Contributor

not adding "needs testing" because this is just an editor thing

Copy link
Contributor

@ASpoonPlaysGames ASpoonPlaysGames left a comment

Choose a reason for hiding this comment

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

Code looks good.

On the note about clang-format doing tabs wrong, I found a post on reddit about this sort of thing and someone linked to somewhere saying that it worked for them, but that link is now dead :(

@ASpoonPlaysGames ASpoonPlaysGames added READY TO MERGE This mergeable right now and removed needs code review Changes from PR still need to be reviewed in code labels Sep 16, 2023
@GeckoEidechse
Copy link
Member Author

Given #556 I'm not sure if we still need/want this tbh

@ASpoonPlaysGames
Copy link
Contributor

Personally I'd still like this, if not for anything other than making github display tabs at not absurd sizes

@GeckoEidechse GeckoEidechse merged commit b269c4d into main Oct 4, 2023
@GeckoEidechse GeckoEidechse deleted the editorconfig-define-tab-size branch October 4, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
READY TO MERGE This mergeable right now
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants