Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected empty results from textDocument/formatting request #422

Closed
siegel opened this issue May 1, 2021 · 4 comments
Closed

Unexpected empty results from textDocument/formatting request #422

siegel opened this issue May 1, 2021 · 4 comments

Comments

@siegel
Copy link
Contributor

siegel commented May 1, 2021

I'm working on a new LSP client, and I've found a case in which the R language server appears to incorrectly(?) return an empty array of textEdits in response to a textDocument/formatting request.

In the attached example file, the linter reports many cases of incorrect formatting; however, sending textDocument/formatting for the document results in an empty array of textEdits in the reply, and no error reported by the server.

The parameters to the textDocument/formatting request look like this:

{
    insertFinalNewline = 0;
    insertSpaces = 0;
    tabSize = 4;
    textDocument =     {
        uri = "file:///Users/siegel/Desktop/LSPTest/random.r";
    };
    trimTrailingWhitespace = 0;
}

There don't appear to be any other diagnostics or logging reported by the server; it's started using the command: R --slave -e languageserver::run(). Are there any other flags I can add to the command line that might add verbose logging output to stderr?

random.r.zip

@siegel
Copy link
Contributor Author

siegel commented May 3, 2021

…as is now obvious :-) from the above, my client was failing to wrap the format parameters in an options dictionary. In that case, the server evidently decided to do nothing, which on the one hand is certainly legitimate; on the other hand I think an error returned, or some diagnostic logging would have saved a great deal of time. I'll keep this issue open pending your response, but I don't have an especial objection if you choose to close based on "client bug".

@randy3k
Copy link
Member

randy3k commented May 3, 2021

If you run R --slave -e languageserver::run(debug = TRUE) , you should be able to see the error.

@siegel
Copy link
Contributor Author

siegel commented May 3, 2021

@randy3k Thanks for the tip, that is very helpful. Does (or could) the server honor the trace initialization parameter? Currently my client sets that value to verbose, and having that trigger debugging output would help greatly.

@randy3k
Copy link
Member

randy3k commented May 3, 2021

It seems to be a new setting in LSP 3.16, of course, we are happy to honor that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants