zbelial / lspce

LSP Client for Emacs implemented as a module using rust.
GNU General Public License v3.0
154 stars 11 forks source link

How configure lspce for R? #37

Open maikol-solis opened 4 months ago

maikol-solis commented 4 months ago

I tried to use this client with R unsuccessfully.

I added this to my config

(add-to-list 'lspce-server-programs '("ess-r" "R --slave -e languageserver::run()" nil))

But I got these messages

[lspce] [WARN] 2024-04-19 13:33:34.957 Can not get root-uri or lsp-type of current buffer.
[lspce] [WARN] 2024-04-19 13:33:34.960 Failed to connect to lsp server.

What have I done wrong?

Thanks for your help.

zbelial commented 4 months ago

Hi @maikol-solis I have never written any R code. But you can use M-: (lspce--root-uri) and M-: (lspce--lsp-type) from a R buffer to check which one returns null. (There two warnings were reported from lspce--buffer-enable-lsp)

Another thing noteworthy is the first element in each record of lspce-server-programs should be the same with what lspce--lsp-type returns for current buffer, so maybe you should change your config for R (I mean the "ess-r", but as I said, I have never written any R code, and I don't know what major mode you used for R, I may be wrong here)

zbelial commented 4 months ago

I just searched how to use Emacs to write R code, and I think you use ess(so the major mode for R is ess-r-mode), right? If so, then I think your config is right.