Curriculum: [VS Code] Editor setup: tabs vs. spaces

Created on 16 Jan 2019  路  7Comments  路  Source: Techtonica/curriculum

Please create a sub-topic within https://github.com/Techtonica/curriculum/blob/master/vs-code/vscode.md about the following:

In the lesson covering VS Code(https://github.com/Techtonica/curriculum/blob/master/vs-code/vscode.md), I'd like to cover the age-old programmer debate, tabs vs. spaces. I'd like to let apprentices know that this is a heated and hilarious topic (for example, it's in a scene that made me howl in Silicon Valley, and the Stack Overflow blog explored what data they could extract from their developer survey: https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/ , which is, itself, a great example of correlation != causation).

More to the point, I'd like to draw apprentices' attention to the settings on their VS Code. Then if it were up to me, I'd have the entire cohort standardize on using spaces and using 2 spaces per tab. Is it up to me?

=)

Also, look into extensions for VS Code that automatically fix indenting issues and trim trailing whitespaces and newlines at the ends of files.

Seriously though, I think this matters for these reasons:

  • code readability is important. if you're inconsistent about indentation within a file or between files in a project, employers will notice. it's something relatively easy to make consistent, and hones attention to detail.
  • consistency when pairing
  • in code reviews, it's annoying when one person opens a file and then their text editor "helpfully" fixes all the whitespace issues, and then the actual changes you want to make are lost amid whitespace changes in the commit
  • adjusting to working as part of a larger team. wherever they land will probably have opinions.
EASY gssoc19

All 7 comments

Hi @alodahl I would have taken up this issue but the requirement is unclear. Am I meant to state the relevance of tabs and spaces in indentation or to state their differences?

@Rita-Okonkwo state their differences, and a little bit about the debate. Try to use judytuna's ideas =)

I'll unassign you if you change your mind.

@alodahl Okay, thank you very much

Thank you @Rita-Okonkwo ! It would also be ideal if you included

  • instructions to set up VS Code to use "spaces for tabs, 2 spaces per tabs" as your default for new files
  • awareness that VS Code attempts to detect the settings in a file by default

The answer at https://stackoverflow.com/a/29972553 has some helpful info.

You're welcome!!! @judytuna . Just to be clear on something, do you mean that I should create instructions on how to set up VS code so that once the tab button is clicked on, It is synonymous to 2 spaces?

Yes, I do. Thank you!

Hi @alodahl @judytuna I just submitted a PR for this issue

Was this page helpful?
0 / 5 - 0 ratings