question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash on invoking function signature.

See original GitHub issue

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:

errors.js:58 Uncaught Error: Cannot read property 'length' of undefined

TypeError: Cannot read property 'length' of undefined
    at ParameterHintsWidget.render (parameterHintsWidget.js:272)
    at parameterHintsWidget.js:182
    at Emitter.fire (event.js:105)
    at parameterHintsWidget.js:104
    at ParameterHintsWidget.render (parameterHintsWidget.js:272)
    at parameterHintsWidget.js:182
    at Emitter.fire (event.js:105)
    at parameterHintsWidget.js:104
    at errors.js:58

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 inside signature, 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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rcjsuencommented, Sep 1, 2018

@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.

0reactions
hifallcommented, Sep 1, 2018

The official spec says it’s optional: LSP spec, search for SignatureInformation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding crash report: "function signature specialization"
One case I've seen of this kind of crash is when an Obj-C-based object calls a delegate method that's Swift-based, and a parameter...
Read more >
c++ - Can method signature mismatch cause a crash at runtime?
I have a runtime crash in a C++ code which is reproducible only when execute on a Solaris machine SunOS 5.10 Generic_150400-27 and...
Read more >
Crash at start of HTML5 game: RuntimeError: function ...
When I started my game on HTML5 it is crashing in the very beginning, right after Defold loading bar is full and game...
Read more >
Fixing Function Pointers with decltype | Dave Kilian's Blog
This post is about a particularly tricky bug I recently fixed. The issue was an application crash which appeared to violate C's syntax...
Read more >
Crash on async function calls - Compiler - Swift Forums
The problems Async IBAction crash If you mark an @IBAction as async, ... or performSelector do not call the async function directly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found