Closed FvD closed 3 months ago
At first glance it looks like it is connecting to languageserver
because it is able to recieve messages from it, but I think it might be decoding them into utf-8 incorrectly. The content-length header ("\u{c}Content-Length: 871\r\n\r\n"
) appears to have a unicode formatting character appended to the front, which is odd.
The zed source (crates/lsp/src/input_handler.rs#L88) splits the message header by newlines and then looks for the header which starts with the "Content-Length: ". The first couple characters being inserted at the front are then causing it to error out since the pattern matching is unsuccesful.
I would look to see what the locale of your R installation is in (sessionInfo()
) and the locale of your machine as well. Might give some clues? I could also be very wrong!
That's interesting, I had not spotted \u{c}
. It does not appear to be my R session locale - and I keep my machines typically in en_US
, even though I mostly work in Spanish. I have no clue where this character could come from.
> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-suse-linux-gnu
Running under: openSUSE Tumbleweed
Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so; LAPACK version 3.12.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: America/Costa_Rica
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils methods base
other attached packages:
[1] shiny_1.9.1 nvimcom_0.9-165
loaded via a namespace (and not attached):
[1] compiler_4.4.1 magrittr_2.0.3 fastmap_1.2.0 R6_2.5.1
[5] cli_3.6.3 promises_1.3.0 later_1.3.2 htmltools_0.5.8.1
[9] tools_4.4.1 Rcpp_1.0.13 digest_0.6.36 xtable_1.8-4
[13] httpuv_1.6.15 lifecycle_1.0.4 mime_0.12 rlang_1.1.4
>
This was caused by my .Rprofile
! I had a custom startup message and this was causing issues.
Thanks!
Ah good to know! Glad you were able to figure it out. I'll add a note to the readme stating that custom startup messages may cause issues!
The languageserver does not start on opensuse Linux: there is no autocomplete, and no hover info (both do work with the inbuilt Python LSP).
The R languageserver
library(languageserver)
is installed for the user, and for all users, and starts without errors when started manually in an R session.When working with an R file, after installing
zed-r
the following will appear in theZed.log
.After trying to fix this in the settings, I reinstalled Zed to start again from scratch, with a clean settings json. The error is the same remainse the same.
Can you give me pointers how to debug this any further?