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

Signature help not working (typescript) #1576

Closed
blutorange opened this issue Sep 6, 2019 · 1 comment · Fixed by microsoft/monaco-typescript#41
Closed

Signature help not working (typescript) #1576

blutorange opened this issue Sep 6, 2019 · 1 comment · Fixed by microsoft/monaco-typescript#41
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority
Milestone

Comments

@blutorange
Copy link
Contributor

monaco-editor version: 0.18.0

To reproduce, go to the HelloWorld example on the playground and enter hello(. This should bring up the intellisense info for the the function hello. It doesn't and when you open the console, the following error is logged:

VM20 editor.main.js:38 Uncaught Error: Cannot read property 'signatures' of undefined

TypeError: Cannot read property 'signatures' of undefined
    at VM20 editor.main.js:1489
    at VM20 editor.main.js:38

The root cause here seems to be that the SignatureHelpAdapter from the monaco-typescript package returns the wrong type in provideSignatureHelp.

If you take a look a the API docs for provideSignatureHelp, it is supposed to return a ProviderResult<SignatureHelpResult>. But the return type in the monaco-typescript package is still given as Thenable<SignatureHelp>.

Checking the dependencies of the monaco-typescript package, it still depends on "monaco-editor-core": "^0.16.0", while the current version is 0.18.0. When I update the version to 0.18.0, typescript reports that the types are wrong.

blutorange added a commit to blutorange/monaco-typescript that referenced this issue Sep 6, 2019
* Update dependency to monaco-editor-core to 0.18.0
* Fix typing errors:
    * SignatureHelpAdapter#provideSignatureHelp return a wrapped SignatureHelpResult
    * monaco.languages.DocumentSymbol has got a new property: tags

The tags are an array SymbolTags, and the only existing SymbolTag is "Deprecated".
I did not find any information about that in the ts.NavigationBarItem, so the tags
are always an empty array for now.
@alexdima alexdima added this to the August 2019 milestone Sep 18, 2019
@alexdima alexdima self-assigned this Sep 18, 2019
alexdima added a commit to microsoft/monaco-typescript that referenced this issue Sep 18, 2019
@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority labels Sep 18, 2019
@MarshyMimz
Copy link

Hi,

I'm getting the same error for monaco version 0.18.1.

I defined my own language and want to provide parameter hints for my own custom functions. Here is what is how I defined the monaco.languages.registerSignatureHelpProvider() :

monaco.languages.registerSignatureHelpProvider('LUM', {
signatureHelpTriggerCharacters: ['(',','],
provideSignatureHelp: function(model, position) {
console.log('Signature Help');
return {
activeSignature: 0,
activeParameter:0,
signatures:[{
label: 'string SUBSTRING(string $string, int $start, int $length)',
documentation: " this method returns a subset of a string",
parameters: [{
label: 'string $string',
documentation: "The input string. Must be one character or longer."
},
{
label: 'int $start',
documentation: "This can not be negative and can't be equal to the length
of the string."
},{
label: 'int $length',
documentation: "Must be positive"
}
]
}]
};
}
});

The Signature Help does print on console but there is no parameter suggestion provided by the above function in the browser

Thanks in advance :)

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants