languageserver icon indicating copy to clipboard operation
languageserver copied to clipboard

languageserver/editor become unresponsive when .Rprofile prints to stdout

Open randy3k opened this issue 4 years ago • 2 comments
trafficstars

I recently got a report from the Sublime Text extension LSP-R about a user cannot get the server running.

After some investigation, it is caused by a line in his .Rprofile which writes to stdout. The exact line is not important, a reproducible example could be just

# put in .Rprofile
cat("Welcome to R\n")

If stdio interface is used (which is the case of Vim, Emacs and Sublime Text users), this unexpected line breaks the communication between R and the editor. Vscode users are luckier because socket connection is used in default.

Possible solution: we could add the --vanilla flag in our documentation, but it will break some users if they rely on anything in .Rprofile.

randy3k avatar Oct 17 '21 17:10 randy3k

We should at least respect .Rprofile or otherwise languageserver will not work for projects using renv.

If stdio is used, is it possible to make the client start processing the languageserver stdout after it receives some special string, something like the ---vsc--- delim used by vscode-R and VSCode-R-Debugger?

renkun-ken avatar Oct 17 '21 23:10 renkun-ken

Technically we could do it, but it requires one to add code to the editor language client which defeats the benefits of having a universal protocol in the first place.

randy3k avatar Oct 18 '21 05:10 randy3k