Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R LSP crashes in VSCode - username HOME directory with an accent #662

Open
sbwiecko opened this issue Mar 26, 2024 · 3 comments
Open

R LSP crashes in VSCode - username HOME directory with an accent #662

sbwiecko opened this issue Mar 26, 2024 · 3 comments

Comments

@sbwiecko
Copy link

sbwiecko commented Mar 26, 2024

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"
@sbwiecko
Copy link
Author

sbwiecko commented Mar 27, 2024

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

@Yunuuuu
Copy link
Contributor

Yunuuuu commented Apr 1, 2024

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?

@sbwiecko
Copy link
Author

sbwiecko commented Apr 5, 2024

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants