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

provideSignatureHelp doesn't seem to render anything despite being called and returning data #10665

Closed
DanTup opened this issue Aug 18, 2016 · 7 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Milestone

Comments

@DanTup
Copy link
Contributor

DanTup commented Aug 18, 2016

  • VSCode Version: 1.4
  • OS Version: Windows 10

I'm trying to implement a signatureHelpProvider (which I believe is the thing that gives me parameter hints when I type ( or , when calling a method/signature/etc.).

My code seems to be called; I see "running" in the console whenever I type a ( but nothing ever appears in the editor! Here's my code:

provideSignatureHelp(document: TextDocument, position: Position, token: CancellationToken): SignatureHelp {
    console.log("running...");
    return {
        activeParameter: 0,
        activeSignature: 0,
        signatures: [{
            label: "test",
            documentation: "test2",
            parameters: [
                {
                    label: "test3",
                    documentation: "test4",
                }
            ]
        }]
    };
}

There are no errors shown anywhere, but also no popup. I've tried 1-based indexes for activeParameter/activeSignature but no difference.

Any ideas what might be causing this or how I could debug further?

@jrieken jrieken added this to the August 2016 milestone Aug 19, 2016
@jrieken jrieken added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Aug 19, 2016
@jrieken
Copy link
Member

jrieken commented Aug 19, 2016

I'll investigate

@jrieken
Copy link
Member

jrieken commented Aug 19, 2016

Ok, the problem is that we spec vscode.SignatureHelp as a class and the method above returns an object literal which fails the instanceof check. It's an ongoing debate whether TypeScript should flag this as compile error or not - both things are structurally equal but instanceof is nominal check.

When you return something like new vscode.SignatureHelp it will work

@jrieken jrieken closed this as completed Aug 19, 2016
@DanTup
Copy link
Contributor Author

DanTup commented Aug 19, 2016

Aha; gotcha! I will change it over and give it a whirl today. Thank you! 😄

@jrieken
Copy link
Member

jrieken commented Aug 19, 2016

and for reference: microsoft/TypeScript#8168

@DanTup
Copy link
Contributor Author

DanTup commented Aug 19, 2016

By the way, I've implemented most of my providers this way and they all seemed to work, I presume this is something specific to signatures that the others don't do?

@jrieken
Copy link
Member

jrieken commented Aug 19, 2016

You might just be lucky ;-) Often we only check if something is an array but not the array types... Tho there are plans to accept both - class instances and look-alike literals

@DanTup
Copy link
Contributor Author

DanTup commented Aug 19, 2016

Btw, in some sample code in the issue you linked, you warn on bad stuff:

            } else {
                // warn about everything else
                console.warn('INVALID result from completion provider. expected CompletionItem-array or CompletionList but got:', value);
                return;
            }

But for this one, you don't. If easy to add, a warning might make it easier for understand what's happening.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

2 participants