Reputation: 958
I am using Atom as an editor and pushed my code up to Github, but some of the indentation is randomly off. This is super embarrassing. Anyone know the fix?
For example, in Atom, one line looks like:
render() {
if (this.state.error)
return <p>Please enter a valid user.</p>
if (!this.state.userData) return <p>Loading</p>
And on Github, same line looks like:
render() {
if (this.state.error)
return <p>Please enter a valid user.</p>
if (!this.state.userData) return <p>Loading</p>
When I copied and pasted the second snippet of code from github, it pasted properly, the same as the first snippet, but is looking ugly in github. I recently reset my tabs from 4 spaces back to default 2, if that info is any help in resolving this.
Upvotes: 1
Views: 913
Reputation: 311
Try never using the tab button to do the auto 2-space or 4-space thing, go back through the code, change all tabs to spaces, and try again. This is a bug commonly found when cross-contaminating Python 2 and Python 3 code with non-matching workspaces, text editors, IDEs, and the like. It's probably that you need to either use tabs ALL THE TIME or use spaces ALL THE TIME.
Upvotes: 2