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
{{ message }}
Repository navigation
Diagnostic source markers in the editor gutter get muddled when both "Run diagnostics in background" and "Check code for problems when saving" are checked #10430
RStudio Edition : Desktop
RStudio Version : 2022.06.0-daily+26
OS Version : macOS Monterey 12.1, aarch64-apple-darwin20 (64-bit)
R Version : R-devel (4.2 2022-01-11 r81471)
Steps to reproduce the problem
The behavior is wonky and difficult to pin down, but here's my best attempt and reproducing the behavior.
Create a file with a bunch of diagnostic issues:
add_numbers <- function(x,y) {
x + y
}
add_numbers(1)
list(
first = 1
second = 2
)
hw <- HoltWinters(ldeaths)
p <- predict(HW, n.ahead = 36, level = 0.95)
add_two <- function(number_1, number_2) {
result <- number_1 + number_2
return(number_1 + number_2)
}
x<-2+1 # comment
In Tools > Global Options > Code Diagnostics, select the following options
Diagnostic markers appear in the gutter, on lines 5, 8, 13, 16, and 20. Great.
Edit the file, adding 2 blank lines after line 11. Save the file. Restart R Session (Shift + Cmd + 0).
Now the source markers in the gutter are all messed up. All markers now appear twice. Old line 5 and old line 8 are still on lines 5 and 8, and the markers on those lines are duplicated (one with unrendered symbols, one correctly). Old line 13 and old line 20 are still there, despite the associated code having been moved, and the symbols are not rendered correctly, but they also appear on lines 15 and 22, where they should be, and rendered correctly.
I was also able to produce the same issue even with "Run diagnostics in background" unchecked and "Check code for problems when saving", with or without refreshing the R session.
Describe the problem in detail
There's a weird persistence and duplication of source markers when refreshing the R session. Sometimes, it seems like this can happen even without refreshing the R session. Sometimes, it seems like this can happen even if only one of "Check code for problems when saving" or "Run diagnostics in background" are checked.
Describe the behavior you expected
Source markers should render correctly and only display on the line of code where the associated code now lives.
I've reproduced it successfully now. Restarting R definitely triggers it. The code diagnostics has to have run so it produces source markers. Restarting R likely triggers the linting code and adds the source markers for the gutter, which creates the duplicates.
Activity
jgutman commentedon Jan 26, 2022
cc @kevinushey who might be familiar with what's going on here
jgutman commentedon Jan 26, 2022
This behavior does not exist in 2022.02.0-preview+405 or 2022.06.0-daily+13. It appears to be introduced in 2022.06.0-daily+14
astayleraz commentedon Jan 26, 2022
This looks like it came up in our automation https://build.rstudioservices.com/job/IDE/job/qa-automation/1831/testReport/rstudio_server_pro.tests.test_VisualMarkdownEditor/TestVisualMarkdownEditor/test_linting_error_appears_in_gutter/

We are expecting what shows on the left which is Prairie Trillium and now get what is on the right with Spotten Wakerobin.
timtmok commentedon Jan 31, 2022
I've reproduced it successfully now. Restarting R definitely triggers it. The code diagnostics has to have run so it produces source markers. Restarting R likely triggers the linting code and adds the source markers for the gutter, which creates the duplicates.
jgutman commentedon Feb 1, 2022
Note that we can see this duplicate issue in the diagnostics under the visual markdown editor as well.
Code:
when editing the markdown in Visual mode and restarting the R session
jgutman commentedon Feb 8, 2022
Verified this is fixed in RStudio Desktop 2022.06.0+76, tested on Mac OS 12.2 with R-devel 4.2.0