You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tidyverse style guide does encourage the use of spaces, not tabs.
We'd principally prefer an approach that operates on the parse table and not on the text input, so third-party style guides could leave tabs untouched.
There seems another bug in the parser that might be relevant for this.
styler::style_text("if (TRUE) {\n\tNULL\n}")
#> if (TRUE) {#> NULL#> }
The code just made sure that the roundtrip check isn't fooled by the automatic conversion from tabs to spaces, because we can't distinguish them from the getParseData() output.
Ok, and due to the way we serialise, the output will never contain tabs anymore, right? The parser bug remains:
getParseData() counts 1 tab as a variable number of spaces instead of one
That might get unexpected results with strict = FALSE, e.g. where spaces around operators are to be preserved and tabs are not interpreted as two spaces. Should we neglect that?
To support this we'd need to be able to tweak the number of spaces per tab. We might look into this if this turns out to be an important use case, but currently this seems rather low priority.
Activity
lorenzwalthert commentedon Sep 21, 2017
Reference: #100.
krlmlr commentedon Sep 22, 2017
This already works for me:
The code just made sure that the roundtrip check isn't fooled by the automatic conversion from tabs to spaces, because we can't distinguish them from the
getParseData()output.[-]tab conversion[/-][+]Tab conversion[/+]lorenzwalthert commentedon Oct 29, 2017
Ok, and due to the way we serialise, the output will never contain tabs anymore, right? The parser bug remains:
That might get unexpected results with
strict = FALSE, e.g. where spaces around operators are to be preserved and tabs are not interpreted as two spaces. Should we neglect that?krlmlr commentedon Oct 31, 2017
To support this we'd need to be able to tweak the number of spaces per tab. We might look into this if this turns out to be an important use case, but currently this seems rather low priority.