vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Extension keeps trying to run unit tests in current console

Open gowerc opened this issue 2 years ago • 4 comments

Describe the bug

Apologies I've not been able to generate a minimal reproducible example yet but I am currently experiencing a breaking issue where the "attached" vscode-R R code keeps attempting to run my testthat unit tests every time I try to run anything in the console.

Please see the Gif below.

For reference my code repository in question and commit that is causing this issue is here. In particular I am in the tests/testthat/test-SurvivalExponential.R file trying to run the code SurvivalExponential() via a keyboard shortcut for workbench.action.terminal.runSelectedText.

When I open a terminal + R without "attaching" the vscode-R code I do not get this issue. I tried searching my code and .Rprofile for any instances of test() / check() or anything else that might be loading the tests but I couldn't find anything.

Gif of Issue

For reference (because its not clear from the gif) the SurvivalExponential() code I am running just creates an S4 object with some string slots; the "Compiling Stan program" comes from the unit tests being run as the first step of my unit tests is to compile a Stan model. The point being highlighted is that the unit tests are being executed even though I've not run anything. Again to highlight this when I load R normally without "attaching" the vscode R code this doesn't happen

2023-10-18 14 10 57

Can you fix this issue by yourself? (We appreciate the help)

No

(If yes,) can we assist you with anything?

(If applicable) Please attach setting.json

    "r.alwaysUseActiveTerminal": true,
    "r.liveShare.defaults.shareWorkspace": false,
    "r.lsp.promptToInstall": false,
    "r.session.objectTimeout": 10,
    "r.session.useWebServer": true,
    "r.sessionWatcher": true,

Expected behavior That vscode-R doesn't keep attempting to run my unit tests

Environment (please complete the following information):

  • OS: macOS (13.3.1)
  • VSCode Version: 1.83.1
  • R Version: 4.3.1
  • vscode-R version: 2.8.2

Additional context Add any other context about the problem here.

gowerc avatar Oct 18 '23 13:10 gowerc

Hi @gowerc, sorry for not seeing this sooner! Is this still an issue? At first glance, I wonder if it has something to do with how we examine symbols for the workspace viewer. Admittedly I have 0 experience with S4, but I can take a look!

ElianHugh avatar Mar 01 '24 12:03 ElianHugh

Hey @ElianHugh , no worries at all !

Unfortunately yes this is still an issue. For the time being I've just been using regular R console without the watcher attached but every time I attach it to the above project I get the issue :(

gowerc avatar Mar 01 '24 12:03 gowerc

Weird, I haven't been able to replicate this. I've cloned your repo at the linked commit, and I've bound workbench.action.terminal.runSelectedText to F12, but running the selected text is working as expected on my end. It's bizarre that it's only happening with attached terminals though.

Are there any other settings that I could try to replicate this with on my end?

ElianHugh avatar Mar 02 '24 21:03 ElianHugh

@ElianHugh - Thanks for looking, I'll try and have a play with this later in the week to see if I can narrow down which extension(s) / settings / system setting is causing this and get back to you

gowerc avatar Mar 05 '24 16:03 gowerc