Closed pwang2 closed 2 years ago
I cannot reproduce it on macOS, are you on a non-UTF8 locale? In general, it is best to only use ASCII characters in R code, in fact non-ASCII characters are even forbidden on CRAN.
I tried both C.UTF-8 and en_US.UTF-8 locales and got the same problem. I was able to reproduce on a new Ubuntu 18.04.6 LTS VM with new R installation 3.6.3. I am trying to provide a reproduce step with docker now.
I was able to reproduce using the following container.
docker run --rm -it r-base:3.6.3 R
# In container R repl
install.packages(c("styler", "prettycode"))
library(prettycode)
highlight(styler::style_text('a <- c( "TΔ", "An")'))
This might be helpful to investigate.
Any Update?
No, do not use non-ascii characters in code: https://github.com/r-lib/prettycode/issues/18#issuecomment-1007695821
I was debugging a weird formatting issue here(https://github.com/r-lib/styler/issues/897), and the root cause was targeted to
prettycode
's replace_in_place function. Can you help diagnose why there is an extra quote before "An" was kept in thereplace_in_place
function?