Repository navigation
Description
System details
RStudio Edition : Desktop
RStudio Version : 1.4.1106
OS Version : macOS Mojave 10.14.6
R Version : R version 4.0.3 (2020-10-10)
Steps to reproduce the problem
foo <- shiny::HTML('<div style="color:red;">I am red</div>')
bar <- shiny::HTML('<p style="color:red;">I am red</p>')
inherits(foo, "html")
#> [1] TRUE
inherits(bar, "html")
#> [1] TRUE
markers <- list(
list(
type = "error",
file = getwd(),
line = 145,
column = 1,
message = foo),
list(
type = "info",
file = getwd(),
line = 145,
column = 1,
message = bar))
rstudioapi::sourceMarkers("Test Name", markers)Created on 2021-02-23 by the reprex package (v1.0.0)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.0.3 (2020-10-10)
#> os macOS Mojave 10.14.6
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Berlin
#> date 2021-02-23
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2)
#> backports 1.2.1 2020-12-09 [1] CRAN (R 4.0.2)
#> cli 2.2.0 2020-11-20 [1] CRAN (R 4.0.2)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.1)
#> fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.2)
#> fastmap 1.0.1 2019-10-08 [1] CRAN (R 4.0.2)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
#> highr 0.8 2019-03-20 [1] CRAN (R 4.0.2)
#> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2)
#> httpuv 1.5.4 2020-06-06 [1] CRAN (R 4.0.2)
#> knitr 1.30 2020-09-22 [1] CRAN (R 4.0.2)
#> later 1.1.0.1 2020-06-05 [1] CRAN (R 4.0.2)
#> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2)
#> mime 0.9 2020-02-04 [1] CRAN (R 4.0.2)
#> pillar 1.4.7 2020-11-20 [1] CRAN (R 4.0.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2)
#> promises 1.1.1 2020-06-09 [1] CRAN (R 4.0.2)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.2)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2)
#> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
#> reprex 1.0.0 2021-01-27 [1] CRAN (R 4.0.2)
#> rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.3)
#> rmarkdown 2.5 2020-10-21 [1] CRAN (R 4.0.3)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.2)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2)
#> shiny 1.5.0 2020-06-23 [1] CRAN (R 4.0.2)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.2)
#> styler 1.3.2 2020-02-23 [1] CRAN (R 4.0.2)
#> tibble 3.0.5 2021-01-15 [1] CRAN (R 4.0.2)
#> vctrs 0.3.6 2020-12-17 [1] CRAN (R 4.0.2)
#> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2)
#> xfun 0.19 2020-10-30 [1] CRAN (R 4.0.2)
#> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.0.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.2)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/libraryDescribe the problem in detail
I already filed an issue at rstudioapi yet have been able to track down the problem now.
The help of ?rstudioapi::sourceMarkers states:
Note that if the message field is of class "html" (i.e. inherits(message, "html") == TRUE) then its contents will be treated as HTML.
However, when running the Code above, the text is evaluated as is, not as html.
Describe the behavior you expected
I actually expected this when providing text of class HTML:

I was able to track down and solve the issue by just switching these two lines. The .rs.scalar() function overwrites the class of an object to "rs.scalar". Therefore, the following line, which checks whether the message string inherits the "html" class, is determined to be FALSE. Changing the order of those lines would solve the issue.
# .rs.scalar() function:
function (obj) {
if (!is.null(obj))
class(obj) <- "rs.scalar"
return(obj)
}
- I have read the guide for submitting good bug reports.
- I have installed the latest version of RStudio, and confirmed that the issue still persists.
- If I am reporting a RStudio crash, I have included a diagnostics report.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity
ronblum commentedon Mar 4, 2021
@mnist91 Thank you for raising this! I made a slight tweak to the code—a comma was missing. I'll mark this for review as we continue development of RStudio.
github-actions commentedon Sep 1, 2021
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.
stale commentedon Sep 15, 2021
This issue has been automatically closed due to inactivity.
mikebessuille commentedon Nov 15, 2021
Reopened due to significant community interest
10 remaining items
jgutman commentedon Jan 25, 2022
This seems like it causes some issues in the way source markers are displayed in the Diagnostics pane.
In 2022.06.0.26 RStudio Desktop on Mac OS 12.1, with all R code diagnostics enabled the following code produces 6 source markers:
These display incorrectly both in the gutter text and in the Diagnostics pane (Code Tools > Show Diagnostics)
In the gutter text, they are duplicated (once with correct display and once incorrectly):
[This issue appears to be introduced in 2022.06.0+14]
In the diagnostics pane, symbols are not displayed correctly:

[This issue appears to be introduced in 2022.06.0+8]
In 2022.06.0.7 RStudio Desktop on Mac OS 12.1, these markers all display correctly as expected. It seems the enabling of HTML negatively impacts the rendering of extremely common symbols for code diagnostics (e.g.
<>'etc)jgutman commentedon Feb 4, 2022
@timtmok, will your planned changes address the issues found here as well?
timtmok commentedon Feb 4, 2022
@jgutman Yes, it'll fix this too. It's all in one PR to fix the gutter, RMarkdown visual mode, and the Code Diagnostics markers. Just waiting on review. #10491
jgutman commentedon Feb 4, 2022
jgutman commentedon Feb 8, 2022
Note this does not appear to be working fully in 2022.6.0.76
timtmok commentedon Feb 9, 2022
The 2022.6.0.76 build should address the markers showing in the Markers pane. Although, we can keep this open until #10062 is also fixed.
jgutman commentedon Feb 18, 2022
See QA comments on #10062
jgutman commentedon Feb 18, 2022
This looks good now, but just to confirm @timtmok -- I believe previously the source code diagnostic markers, if enabled, would show up in the left gutter as well as the Markers pane below. They no longer appear to show up in the Markers pane, only in the gutter. Is this intentional?
-- On further thought I believe this is not a regression, the diagnostics show up if you select "Show Diagnostics for Current Document" or "Show Diagnostics for Current Project" from the Command Palette, but seem to not show up in the list of possible markers if you simply open the Markers pane with Diagnostics enabled, even if they show in the gutter. This could perhaps be sorted out in a separate issue