【问题标题】:Visual Studio Code - R Language ServerVisual Studio Code - R 语言服务器
【发布时间】:2021-04-12 10:16:16
【问题描述】:

我习惯使用 RStudio。但是,最近我遇到了 Visual Studio Code,并成功地将它安装在我的 PC 上。我遵循了坤仁的文章的所有描述:

https://renkun.me/2019/12/11/writing-r-in-vscode-a-fresh-start/

但是,当我启动 VS Code 时,我收到以下错误消息:

R 语言服务器 (5016) 已启动 错误:在以“'C:\U”开头的字符串中使用了没有十六进制数字的“\U” 执行停止 R 语言服务器 (5016) 以退出代码 1 退出

我的 settings.json 看起来像这样:

{
    "r.bracketedPaste": true,
    "r.rterm.windows": "C:\\Users\\AppData\\Roaming\\Python\\Python39\\Scripts\\radian.exe",
    "r.rpath.windows": "C:\\Program Files\\R\\R-4.0.5\\bin\\x64\\R.exe",
    "r.lsp.debug": true,
    "r.lsp.diagnostics": true,
    "r.sessionWatcher": true,
    "r.rterm.option": [
        "--no-save",
        "--no-restore",
        "--r-binary=C:\\Program Files\\R\\R-4.0.5\\bin\\x64\\R.exe"
    ],
}

非常感谢您的帮助!

问候, 亨利

【问题讨论】:

    标签: r visual-studio-code


    【解决方案1】:

    找到您的 .Rprofile 文件。里面应该有一行写着:

    options(langserver_library = '<path to>\languageserver-library')
    

    将反斜杠改为正斜杠,然后重启 VS Code 和 R。

    【讨论】:

    • 魏黄您好,非常感谢您的回答! VS Code 现在与 R 语言服务器一起运行。我使用了太多不同的来源来安装它,这就是为什么它在第一次尝试时没有成功。卸载 VS Code 后,按照坤仁的指导,安装终于成功了。很高兴有带有 R 语言服务器的 VS Code 作为 RStudio Client 的替代品。仍然需要为我学习很多编码:-) 再次感谢您帮助我,并为我迟到的回复感到抱歉!问候,亨利
    猜你喜欢
    • 1970-01-01
    • 2019-01-25
    • 1970-01-01
    • 2016-06-05
    • 1970-01-01
    • 1970-01-01
    • 2018-12-28
    • 2019-07-17
    相关资源
    最近更新 更多