REditorSupport / REditorSupport/vscode-R

"conflicted" is evoked for each prompt

Open
#1,424 1 comment 0 reactions 1 assignee View on GitHub

@ElianHugh is already working on this.

Since Mar 1, 2024.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Describe the bug
When there is a conflict on setdiff(), conflicted complains about it every time a new prompt > shows up even when the function was not called by a user. I guess the cause is the use of setdiff() in vscode-R given that this issue does not happen in a session without source("~/.vscode-R/init.R"). It does not happen with R.app, RStudio, or bare /usr/local/bin/R.

setdiff() was the trigger this time, but potentially any conflict in functions used by vscode-R can cause the similar issue.

To Reproduce

  1. Setup vscode-R and source("~/.vscode-R/init.R").
  2. Setup some conflicts: install conflicted, tidyverse, and BiocGenerics (or any packages that export setdiff()).
  3. library(conflicted)
  4. library(tidyverse)
  5. library(BiocGenerics)
  6. Do something: ls(), 1 + 1, or whatever.

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

No. I guess adding an explicit namespace base:: to setdiff() in R/session/vsc.R can be a quick fix for this issue.

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

(If applicable) Please attach setting.json

    "r.helpPanel.clickCodeExamples": {
      "Click": "Ignore",
      "Shift+Click": "Copy"
    },
    "r.plot.useHttpgd": false,
    "r.rmarkdown.enableCodeLens": false,
    "r.session.viewers.viewColumn": {
      "plot": "Disable"
    },
    "r.sessionWatcher": true,

Expected behavior
vscode-R does not stimulate "conflicted" package even when there are some conflicts.

Screenshots

> library(BiocGenerics)
[conflicted] setdiff found in 3 packages.
Either pick the one you want with `::`:
• BiocGenerics::setdiff
• lubridate::setdiff
• base::setdiff
Or declare a preference with `conflicts_prefer()`:
• `conflicts_prefer(BiocGenerics::setdiff)`
• `conflicts_prefer(lubridate::setdiff)`
• `conflicts_prefer(base::setdiff)`> 1 + 1
[1] 2
[conflicted] setdiff found in 3 packages.
Either pick the one you want with `::`:
• BiocGenerics::setdiff
• lubridate::setdiff
• base::setdiff
Or declare a preference with `conflicts_prefer()`:
• `conflicts_prefer(BiocGenerics::setdiff)`
• `conflicts_prefer(lubridate::setdiff)`
• `conflicts_prefer(base::setdiff)`>

Environment (please complete the following information):

  • OS: macOS
  • VSCode Version: 1.82.2
  • R Version: 4.3.1
  • vscode-R version: 2.8.1

Additional context

setdiff from BiocGenerics may not be conflicting in the first place (r-lib/conflicted#8).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.