languageserver
languageserver copied to clipboard
languageserver/editor become unresponsive when .Rprofile prints to stdout
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.
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?
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.