rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.69k stars 1.09k forks source link

Console output with missing characters when compiling Rcpp code that have errors. #8211

Open franzbischoff opened 4 years ago

franzbischoff commented 4 years ago

System details

RStudio Edition : Desktop
RStudio Version : Version 1.4.953
OS Version      : Windows 10 and WSL
R Version       : 4.0.3
Rtools          : Rtools40

Steps to reproduce the problem

Compile Rcpp code that contains errors.

Describe the problem in detail

Using RStudio (stable version too) on Windows and Rstudio server on WSL (at least), the error messages have missing characters, like in this example: image

using WSL: image

I tried to remove options:

And I tried to change fonts: Lucida Console, Courier, Noto Mono, Consolas, Firacode.

The problem persists:

Without Show syntax highlighting in console output: image

Plus without Different color for error or message output and Removing ANSI colors image

Plus Ignoring ANSI colors: image

Describe the behavior you expected

The expected output is in the image below, using the RGui or RConsole:

image

kevinushey commented 4 years ago

Compile Rcpp code that contains errors.

I realize these repro steps are "obvious", but it would be helpful if you provided us with a more concrete set of steps to reproduce -- even if that was a package (e.g. on GitHub) that we could clone + checkout some specific branch to quickly open and reproduce on build.

franzbischoff commented 4 years ago

There it is:

Repo link

Clone the repo, open in Rstudio and hit Ctrl+Shit+L, or devtools::load_all(".")

You should see this ugly format in console: image

ronblum commented 4 years ago

I can reproduce this on Windows 10. It is not an issue on MacOS 11.

kevinushey commented 4 years ago

@franzbischoff: awesome, thank you! We really appreciate your taking the time to make this easily reproducible.

kevinushey commented 4 years ago

FWIW, I wasn't able to reproduce at first:

Screen Shot 2020-10-29 at 12 37 15 PM

I had to explicitly set:

writeLines("PKG_CXXFLAGS = -fdiagnostics-color=always", con = "src/Makevars")

to ensure colored compiler output. Were those C++ flags set by you, or do you know if they're coming from somewhere else?

franzbischoff commented 4 years ago

Not by me.

I searched for Makevars without success on:

I found Makevars.win on C:\Program Files\R\R-4.0.3\src\library\windlgs\src\Makevars.win with this content: PKG_LIBS=$(GRAPHAPP_LIB)

Additionally, I tried to remove as many options as I could from RStudio settings. No luck.

Plus: compiling via Rgui or R.exe, the -fdiagnostics-color=always option is not used.

franzbischoff commented 3 years ago

Setting this ENV turns the result slightly better (at least the error turns on red and little is deleted from the output):

Sys.setenv(GCC_COLORS='error=31:quote=')

Still, this seems to be a problem with the terminal handling colors. For e.g., MSYS terminal works fine.