-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Crash on invoking function signature. #1045
Comments
@hifall How are you hooking up the language server to your Monaco editor? Are you using TypeFox's |
@rcjsuen, yes. |
@hifall As the API does not state that it is optional, I believe this is a bug in Of course, if the VS Code team wants to loosen up their API requirement, they are welcome to do so. Irregardless of their decision, we should fix |
The official spec says it's optional: LSP spec, search for |
@hifall That's the LSP specification and not the Monaco/VS Code API. They may look like they are 1-to-1 but they do not have to be 1-to-1. It's up to bridges like the TypeFox/monaco-languageclient and Microsoft/vscode-languageserver-node projects to alter LSP information into a way that is consumable by the client editor. |
monaco-editor version: 0.14.3
Browser: Chrome 67.0.3396.99
OS: macOS 10.12
Okay, it seems like a VS Code issue from where the crash happens, but since I am using Monaco, I am filing it here.
I am using Monaco editor connected with a backend language server. When trying to invoke displaying the signature of a function, I am seeing a crash with the following call stack in the browser console:
The Monaco client sends a request like this:
{"jsonrpc":"2.0","id":6,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"/home/model.r"},"position":{"line":36,"character":6}}}
And the language server responds with:
{"jsonrpc":"2.0","id":6,"result":{"signatures":[{"label":"paste(..., sep = \" \", collapse = NULL)"}],"activeSignature":0}}
This happens because of the following line inside ParameterHintsWidget's render function:
var hasParameters = signature.parameters.length > 0;
This line assumes that
parameters
field always present insidesignature
, while in fact parameters is absent from the server response above. However, the LSP specification says SignatureInformation's parameters is optional. Therefore, the assumption doesn't seem correct.The text was updated successfully, but these errors were encountered: