I am running VS Code on a remote server to develop R code and analyze data. I have the Remote Development extensions installed on my local machine and the R extension installed on both my local machine and my remote server. Whenever I have a file with R code open, I get a constant stream of pop-ups from the R Language Server Output with messages that look like the following:
[Error - 10:07:44 PM] Client R Language Server: connection to server is erroring.
Header must provide a Content-Length property.
{"{\"jsonrpc\"":"\"2.0\",\"id\":30,\"result\":[{\"range\":{\"start\":{\"line\":41,\"character\":0},\"end\":{\"line\":41,\"character\":4}},\"kind\":1},{\"range\":{\"start\":{\"line\":55,\"character\":12},\"end\":{\"line\":55,\"character\":16}},\"kind\":1},{\"range\":{\"start\":{\"line\":56,\"character\":21},\"end\":{\"line\":56,\"character\":25}},\"kind\":1},{\"range\":{\"start\":{\"line\":57,\"character\":20},\"end\":{\"line\":57,\"character\":24}},\"kind\":1},{\"range\":{\"start\":{\"line\":58,\"character\":13},\"end\":{\"line\":58,\"character\":17}},\"kind\":1},{\"range\":{\"start\":{\"line\":59,\"character\":15},\"end\":{\"line\":59,\"character\":19}},\"kind\":1},{\"range\":{\"start\":{\"line\":60,\"character\":4},\"end\":{\"line\":60,\"character\":8}},\"kind\":1}]}Content-Length: 37"}
The error seems to be specific to remote development in R -- I do not get these errors when I am developing locally or when I have remote files open in other languages.
Does anyone have any suggestions on what might be wrong? I am not entirely sure how to troubleshoot this. I am using the native R terminal (not radian) and have httpgd installed.
I have the following in my remote VS Code settings:
{
"r.libPaths": [
"~/R/x86_64-pc-linux-gnu-library/4.4"
],
//"r.bracketedPaste": true,
"r.rpath.linux": "</path/to>/x86_64/bin/R",
"r.rterm.linux": "<path/to>/x86_64/bin/R",
"r.lsp.use_stdio": true,
"r.lsp.debug": false,
"r.lsp.diagnostics": true,
"r.sessionWatcher": true,
"r.plot.useHttpgd": true,
"r.session.watchGlobalEnvironment": true,
"[r]": {
"editor.wordSeparators": "`~!@#%$^&*()-=+[{]}\\|;:'\",<>/?"
}
}
I have tried to enable r.bracketedPaste and r.lsp.debug but can't get any additional information.
I have the following in my R sessionInfo():
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS
Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLASOPENMP; LAPACK version 3.12.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
time zone: America/Los_Angeles
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.4.1
I also tried to set up the language server following this blog post but didn't get any difference in results. I have the following in my .Rprofile from following those instruction:
if (requireNamespace('languageserversetup', quietly = TRUE)) {
options(langserver_library = '~/languageserver-library')
languageserversetup::languageserver_startup()
unloadNamespace('languageserversetup')
}