REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.07k stars 128 forks source link

R session not attached after starting it if R file is in certain folders #1281

Closed AlessioGr closed 5 months ago

AlessioGr commented 1 year ago

Describe the bug R session is not attached when opening a new R terminal

To Reproduce Steps to reproduce the behavior:

  1. Click on "R: (not attached)
  2. Terminal Opens
  3. It still says R: (not attached)

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

No

(If applicable) Please attach setting.json

{
  "security.workspace.trust.untrustedFiles": "open",
  "files.exclude": {
    "**/.classpath": true,
    "**/.project": true,
    "**/.settings": true,
    "**/.factorypath": true
  },
  "python.defaultInterpreterPath": "/opt/homebrew/anaconda3",
  "python.condaPath": "/opt/homebrew/anaconda3/bin/conda",
  "terminal.integrated.inheritEnv": false,
  "workbench.editor.labelFormat": "medium",
  "workbench.editor.untitled.labelFormat": "name",
  "files.associations": {
    "*.rmd": "markdown"
  },
  "r.bracketedPaste": true,
  "r.rterm.mac": "/opt/homebrew/anaconda3/bin/radian",
  "r.rpath.mac": "/opt/homebrew/bin/R",
  "[r]": {
    "editor.defaultFormatter": "REditorSupport.r"
  },
  "r.rterm.option": [
    "--r-binary=/opt/homebrew/bin/R"
  ],
  "r.plot.useHttpgd": true,
}

Expected behavior It should attach to the Terminal/Session

Screenshots

image

Console output when clicking it:

image

Environment (please complete the following information):

Additional context

Output of ls.str(.vsc):

addin_registry :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I/vscode-R/addins.json"
address : function (x)  
attach : function ()  
capture_str : function (object, max.level = getOption("vsc.str.max.level", 0))  
dataview_table : function (data)  
dir_session :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I/vscode-R"
dir_watcher :  chr "/Users/alessio/.vscode-R"
get_column_def : function (name, field, value)  
get_response_lock : function ()  
get_response_timestamp : function ()  
get_timestamp : function ()  
globalenv_cache : <environment: 0x1024dd870> 
homedir :  chr "/Users/alessio"
inspect_env : function (env, cache)  
load_settings : function ()  
path_to_uri : function (path)  
pid :  int 24880
print.help_files_with_topic : function (h, ...)  
print.hsearch : function (x, ...)  
rebind : function (sym, value, ns)  
request : function (command, ...)  
request_browser : function (url, title, ..., viewer)  
request_file :  chr "/Users/alessio/.vscode-R/request.log"
request_lock_file :  chr "/Users/alessio/.vscode-R/request.lock"
request_response : function (command, ...)  
response_file :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I/vscode-R/response.log"
response_lock_file :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I/vscode-R/response.lock"
response_time_stamp :  chr ""
response_timeout :  num 5
rstudioapi_enabled : function ()  
rstudioapi_env : <environment: 0x103b130c0> 
rstudioapi_util_env : <environment: 0x103b133d0> 
scalar : function (x)  
settings_file :  chr "/Users/alessio/.vscode-R/settings.json"
show_browser : function (url, title = url, ..., viewer = getOption("vsc.browser", "Active"))  
show_dataview : function (x, title, uuid = NULL, viewer = getOption("vsc.view", "Two"), row_limit = abs(getOption("vsc.row_limit", 0)))  
show_globalenv :  logi TRUE
show_page_viewer : function (url, title = NULL, ..., viewer = getOption("vsc.page_viewer", "Active"))  
show_plot :  logi TRUE
show_view :  logi TRUE
show_viewer : function (url, title = NULL, ..., viewer = getOption("vsc.viewer", "Two"))  
show_webview : function (url, title, ..., viewer)  
tempdir :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I"
try_capture_str : function (object, max.level = getOption("vsc.str.max.level", 0))  
try_catch_timeout : function (expr, timeout = Inf, ...)  
update_workspace : function (...)  
use_httpgd :  logi TRUE
user_options :  chr [1:89] "add.smooth" "bitmapType" "browser" "browserNLdisabled" "callr.condition_handler_cli_message" "CBoundsCheck" "check.bounds" "citation.bibtex.max" "continue" "contrasts" ...
wd :  chr "/Users/alessio/Nextcloud/Cloud/Studium/Hochschule der Medien/Fächer/2. Semester/Data Literacy 2/R/Projects/Aufgabe 3"
workspace_file :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I/vscode-R/workspace.json"
workspace_lock_file :  chr "/var/folders/gm/0d5d66dj4mxb0q2fmmms8xzm0000gn/T//RtmpANCn4I/vscode-R/workspace.lock"

~/.Rprofile:

# LanguageServer Setup Start (do not change this chunk)
# to remove this, run languageserversetup::remove_from_rprofile
if (requireNamespace('languageserversetup', quietly = TRUE)) {
  options(langserver_library = '/Users/alessio/languageserver-library')
  languageserversetup::languageserver_startup()
  unloadNamespace('languageserversetup')
}
if (interactive() && Sys.getenv("RSTUDIO") == "") {
  Sys.setenv(TERM_PROGRAM = "vscode")
  source(file.path(Sys.getenv(
    if (.Platform$OS.type == "windows") "USERPROFILE" else "HOME"
  ), ".vscode-R", "init.R"))
}
# LanguageServer Setup End

~/.vscode-R/init.R local(source("/Users/alessio/.vscode/extensions/reditorsupport.r-2.7.0/R/session/init.R", chdir = TRUE, local = TRUE))

~/.vscode-R/settings.json

{
    "rpath": {
        "windows": "",
        "mac": "/opt/homebrew/bin/R",
        "linux": ""
    },
    "debugger": {
        "commandLineArgs": [],
        "timeouts": {
            "startup": 2000,
            "terminate": 50,
            "prompt": 0
        },
        "checkVersion": "recommended",
        "trackTerminals": false
    },
    "rterm": {
        "windows": "",
        "mac": "/opt/homebrew/anaconda3/bin/radian",
        "linux": "",
        "option": [
            "--r-binary=/opt/homebrew/bin/R"
        ]
    },
    "libPaths": [],
    "lsp": {
        "enabled": true,
        "args": [],
        "promptToInstall": true,
        "debug": false,
        "diagnostics": true,
        "lang": "",
        "use_stdio": false
    },
    "rmarkdown": {
        "codeLensCommands": [
            "r.runCurrentChunk",
            "r.runAboveChunks"
        ],
        "enableCodeLens": true,
        "chunkBackgroundColor": "rgba(128, 128, 128, 0.1)",
        "preview": {
            "autoRefresh": true
        },
        "knit": {
            "useBackgroundProcess": true,
            "focusOutputChannel": true,
            "openOutputFile": false,
            "command": "rmarkdown::render",
            "defaults": {
                "knitWorkingDirectory": "document directory"
            }
        }
    },
    "helpPanel": {
        "enableSyntaxHighlighting": true,
        "cacheIndexFiles": "None",
        "previewLocalPackages": [
            "."
        ],
        "rpath": "",
        "enableHoverLinks": true,
        "clickCodeExamples": {
            "Click": "Copy",
            "Ctrl+Click": "Run",
            "Shift+Click": "Ignore"
        }
    },
    "source": {
        "encoding": "UTF-8",
        "focus": "editor"
    },
    "alwaysUseActiveTerminal": false,
    "bracketedPaste": true,
    "sessionWatcher": true,
    "session": {
        "watchGlobalEnvironment": true,
        "objectLengthLimit": 2000,
        "objectTimeout": 50,
        "levelOfObjectDetail": "Minimal",
        "emulateRStudioAPI": true,
        "data": {
            "rowLimit": 0,
            "pageSize": 500
        },
        "viewers": {
            "viewColumn": {
                "plot": "Two",
                "browser": "Active",
                "viewer": "Two",
                "pageViewer": "Active",
                "view": "Two",
                "helpPanel": "Two"
            }
        }
    },
    "rtermSendDelay": 8,
    "workspaceViewer": {
        "showObjectSize": false,
        "removeHiddenItems": false,
        "clearPrompt": true
    },
    "liveShare": {
        "timeout": 10000,
        "defaults": {
            "commandForward": false,
            "shareWorkspace": true,
            "shareBrowser": false
        }
    },
    "plot": {
        "devArgs": {
            "width": 800,
            "height": 1200
        },
        "useHttpgd": true,
        "defaults": {
            "colorTheme": "original",
            "plotPreviewLayout": "multirow",
            "fullWindowMode": false
        },
        "timing": {
            "resizeInterval": 100,
            "refreshInterval": 10
        },
        "customStyleOverwrites": ""
    }
}

I think "Ignored request outside workspace" might be the issue, but I don't know why I'm getting this error, as the R file I'm editing is in my workspace?

AlessioGr commented 1 year ago

Note: Moving my folder to somewhere else fixes it. Maybe Nextcloud is breaking it, as it was previously in a nextcloud-synced folder? If so, is that something you can fix, or at least throw a warning if it happens, as that took me long to figure out

olivedv commented 1 year ago

I had the same issue when my folder was in a synology-synchronized folder. Can anyone assist with fixing the bug?

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] commented 5 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.