emacs-ess / ESS

Emacs Speaks Statistics: ESS
https://ess.r-project.org/
GNU General Public License v3.0
614 stars 160 forks source link

LSP-R fails to start in ESS(R) mode #1153

Closed ECon87 closed 3 years ago

ECon87 commented 3 years ago

Hi,

I am on spacemacs, so I am not sure whether this is an ESS issue or a spacemacs issue. In any case, I am trying to use the lsp server for R files but it fails to start (even after restarts. The lsp--r::stderr file reads:

[2021-07-05 09:22:04.206] error handling json:  Error: lexical error: invalid char in json text.
          = dplyr::lag(polls_diff_D_R{"jsonrpc":"2.0","method":"textDo
                     (right here) ------^

Stack trace:
1: parse_string(txt, bigint_as_char)
2: parseJSON(txt, bigint_as_char)
3: parse_and_simplify(txt = txt, simplifyVector = simplifyVector, 
    simplifyDataFrame = simplifyDataFrame, simplifyMatrix = simplifyMatrix, 
    flatten = flatten, ...)
4: jsonlite::fromJSON(data, simplifyVector = FALSE)
[2021-07-05 09:22:04.248] Error: Unexpected non-empty line
Call: self$read_header()
Stack trace:
1: stop("Unexpected non-empty line")
2: self$read_header()
3: self$fetch(blocking = FALSE)
[2021-07-05 09:22:04.248] exiting

Process lsp-r stderr finished

Any help would greatly be appreciated.

lionel- commented 3 years ago

This doesn't seem like an ESS issue. I'm not sure which venue would be most appropriate for this question but you might try the ess-help mailing list and ask if anyone has experience with LSP?

alexey0308 commented 3 years ago

Hi @ECon87 , just in case if you are not aware: one may switch back to the ess-based completion in spacemacs, if you specify in the layers

(ess :variables
  ess-r-backend 'ess)

while you're looking for solution of the original problem with lsp.

ECon87 commented 3 years ago

Hi @alexey0308,

Thanks for the suggestions. I just tried that, but it says "No associated ESS process". Maybe there is something wrong with my config. I am also on the develop branch of spacemacs. I don't know if they deprecated support for other backends.

Cheers for the reply.

alexey0308 commented 3 years ago

you need to do C-c C-z or , ' to start an R process first.

I don't know if they deprecated support for other backends.

Actually the spacemacs maintainers are more inclined to the lsp backends. But in your case I would rather report to the R languageserver repository or to the emacs lsp-mode friends.

ECon87 commented 3 years ago

Thank you @alexey0308. That worked.

I will report to the suggested repos.

Thanks again.