Closed syxolk closed 7 years ago
Concerning tabs, the short answer: This is intended behaviour. Tabs are not allowed in indentex.
The long answer: I think that enforcing hard tabs was one of golang's wisest design choices (for the record, I abhor hard tabs). Compare this to Python: PEP8 suggests using soft tabs, so everybody would do this, right? Well, no:
I used to work for Yelp. For historical reasons — probably “the initial developers preferred it” — their mostly-Python codebase had always been indented with tabs.
Hence, I decided to allow only soft tabs in indentex so that everybody's on the same page. Indentex source files must be indented using soft tabs, preferably two characters wide.
There is a further aspect to it, however. Indentex cannot detect mixed tabs and spaces. This can lead to very subtle and nasty edge cases. E.g. a user has configured tabs to be two chars wide and has accidentally written this:
# equation:
····a
»··b
This would be transpiled to
\begin{equation}
····a
\end{equation}
»··b
although visually there is no dedent after a
.
As for the indentation with a single space being valid: It's another story. Maybe it might be better to require at least two whitespace chars for a valid indentation. I have to sleep on it.
Ok, can we consider this as another silently ignored edge case #8 that could be fixed together with #9 ?
What exactly, tabs or single-space indentation?
Probably it's a good idea to generate transpilation errors for both of them!
Superseded by #24 and #25
Indentation with tabs does not seem work.
This indentex file:
is transpiled to this:
Update: Indentation with a single space works perfectly:
->