languageserver
languageserver copied to clipboard
R LSP crashes in VSCode - username HOME directory with an accent
Hi everyone, there is an issue in VSCode with R LSP immediately when I launch the program with an R or Rmd file:
R Language Server (13384) started
R library paths: C:/Program Files/R/R-4.3.3/library
[2024-03-26 16:31:59.293] connection type: tcp at 50997
[2024-03-26 16:31:59.307] connected
Error in file.exists(home) :
file name conversion problem -- name too long?
Calls: <Anonymous> ... within.list -> eval -> eval -> make_profiles -> file.exists
Execution halted
I believe it must come from the strange character of my username:
r$> file.path(Sys.getenv("HOME"))
[1] "C:\\Users\\Sébastien\\Documents"
A temporary fix is to create a directory whose path does not have characters too weird for LSP, e.g., C:\R_HOME
, and to set the R Home Directory accordingly, as explained elsewhere:
C:\ ❯ [System.Environment]::SetEnvironmentVariable("R_USER", "C:\R_HOME", [System.EnvironmentVariableTarget]::User)
Then everything works smoothly
R Language Server (11064) started
R library paths: C:/Program Files/R/R-4.3.3/library
[2024-03-27 13:51:41.163] connection type: tcp at 54013
[2024-03-27 13:51:41.174] connected
[2024-03-27 13:51:41.486] received: Content-Length: 5942
[2024-03-27 13:51:41.716] received payload.
[2024-03-27 13:51:41.716] handling request: initialize
This is not a problem of languageserver
package
You can google the error message, this might be an issue with R itself
Error in file.exists(home) : file name conversion problem -- name too long?
I am sure it is not an issue with the latest versions of R, as it, outside the languageserver environement, gives me the right answer
r$> file.path(Sys.getenv("HOME"))
[1] "C:\\Users\\Sébastien\\Documents"