Closed Yemoloh closed 1 year ago
Looks like the R language client does not correctly start and thus not registered as a valid R formatter. Could you go to Output -> R Language Server
and take a look at the log of language server. Does it start correctly?
I have the same problem with pretty much the same configuration.
how should I go to Output -> R Language Server
??
edit: I have installed the binaries by these commands: install.packages("httpgd")
install.packages("languageserver")
could that be the case?
Go to the Output pane and choose "R Language Server" and view the log:
Thank you for your quit reply.
Here is my screenshot, the code runs correctly, but when I hit ALT+Shift+F
I get that error.
And the output looks like this:
Edit: my settings.json
just in case:
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"workbench.iconTheme": "material-icon-theme",
"C_Cpp.updateChannel": "Insiders",
"cmake.configureOnOpen": true,
"explorer.confirmDragAndDrop": false,
"window.zoomLevel": 0,
"editor.lineHeight": 0,
"editor.fontSize": 13,
"workbench.startupEditor": "none",
"http.proxySupport": "off",
"window.restoreWindows": "none",
"stm32-for-vscode.openOCDPath": "D:\\PROGRAM FILES\\OPENOCD\\BIN\\OPENOCD.EXE",
"stm32-for-vscode.makePath": "C:\\PROGRAM FILES (X86)\\GNUWIN32\\BIN\\MAKE.EXE",
"stm32-for-vscode.armToolchainPath": "C:\\PROGRAM FILES (X86)\\GNU ARM EMBEDDED TOOLCHAIN\\9 2020-Q2-UPDATE\\BIN",
"security.workspace.trust.banner": "never",
"security.workspace.trust.enabled": false,
"security.workspace.trust.untrustedFiles": "open",
"r.bracketedPaste": true,
"r.rpath.windows": "\"C:\\Program Files\\R\\R-4.1.2\\bin\\x64\\R.exe\"",
"r.rterm.windows": "C:\\Users\\Kamran\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\radian.exe"
}
Looks like the language server does not start at all.
@ManuelHentschel Does the value of r.rpath.windows
looks correct?
I can use R.exe
address for r.rpath.windows
with/without the double quotations, or even remove the whole r.rpath.windows
entry. The result is the same. The install address of my R executable instance is correct though. Also I when I install languageserver
this is the output:
> install.packages("languageserver")
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cran.ism.ac.jp/bin/windows/contrib/4.1/languageserver_0.3.12.zip'
Content type 'application/zip' length 808148 bytes (789 KB)
downloaded 789 KB
package 'languageserver' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Kamran\AppData\Local\Temp\RtmpqmtkCP\downloaded_packages
>
@ManuelHentschel Does the value of
r.rpath.windows
looks correct?
With the quotes, I get the same error, removing the quotes fixes the error for me.
I removed the quotes and did multiple restarts. Still, there was no success. But I did this once in my R terminal and it was fixed: (Edit: with the quotes being omitted of course)
> library(languageserver)
> languageserver::run
function (debug = FALSE, host = "localhost", port = NULL)
{
tools::Rd2txt_options(underline_titles = FALSE)
tools::Rd2txt_options(itemBullet = "* ")
lsp_settings$update_from_options()
if (isTRUE(debug)) {
lsp_settings$set("debug", TRUE)
lsp_settings$set("log_file", NULL)
}
else if (is.character(debug)) {
lsp_settings$set("debug", TRUE)
lsp_settings$set("log_file", debug)
}
langserver <- LanguageServer$new(host, port)
langserver$run()
}
<bytecode: 0x000000001da7bbc0>
<environment: namespace:languageserver>
>
Would you like to confirm that you are using the following setting:
"r.rpath.windows": "C:\\Program Files\\R\\R-4.1.2\\bin\\x64\\R.exe"
but the language server still cannot start like
R Language Server (undefined) started
Yes, it was like that. With the following setting:
"r.rpath.windows": "C:\\Program Files\\R\\R-4.1.2\\bin\\x64\\R.exe"
I also got this error:
R Language Server (undefined) started
But I ran these commands in my R terminal and the problem was fixed (I ran the commands only one time and it was fixed):
> library(languageserver)
> languageserver::run
My current config (which is working) is still like this:
"r.rpath.windows": "C:\\Program Files\\R\\R-4.1.2\\bin\\x64\\R.exe"
This issue is stale because it has been open for 365 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I wonder if this problem is solved? I meet the same error.
Yes, the issue was solved for me using the procedure I mentioned. However, I've not been using R for months. So I hope the same procedure still works with the newer updates.
In case someone still has this issue: language server also did not start for me, as discussed earlier. I got "R Language Server (-1) started". It turned out that r.rpath.mac
was pointing to an older R version in my library (4.3). I changed r.rpath.mac
to the most recent R version (4.4), which fixed the issue.
Hi, I've installed R on VScode, but when I try to format my code, I have this message : "There is no formatter for 'r' files installed" This is my settings.json
{ "tabnine.experimentalAutoImports": true, "workbench.colorTheme": "Cobalt2", "r.alwaysUseActiveTerminal": true, "r.rpath.windows": "C:\Program Files\R\R-4.1.2\bin", "r.rterm.windows": "C:\Program Files\R\R-4.1.2\bin\R.exe", "files.associations": { "*.rmd": "markdown" }, "r.dependencyChecks": true, "editor.formatOnPaste": true, "editor.formatOnType": true, "r.lsp.debug": true, "[r]": { "editor.defaultFormatter": "Ikuyadeu.r" }, }
Does anybody had this issue before ?
Yemoloh
To Reproduce Steps to reproduce the behavior: