Juan Tarquino
Juan Tarquino

Reputation: 987

How do I provide method parameter info from a Language Server?

I am trying to implement a language server for visual studio code for a language whose method calling is similar to JavaScript (method name plus parameters inside parenthesis).

I would like to provide parameter info (name and type) after the user typed a method and parenthesis based on the position of the cursor inside the parenthesis. For example, when coding in Typescript in vscode, if I type:

Math.pow(

I get a tooltip showing the signature of the method and the first parameter name and type in bold:

first parameter tooltip

then when I enter the first parameter and enter a comma, the tooltip offers details about the second parameter:

second parameter tooltip

I was able to find a way to provide autocompletion on the name of the method, but not the behavior described above for the parameters. Is there an example or a tutorial on how to prompt that tooltip from a language server extension in Visual Studio Code?

Upvotes: 4

Views: 593

Answers (1)

Juan Tarquino
Juan Tarquino

Reputation: 987

I found an example in the official php extension source code. I just had to implement a SignatureHelpProvider.

Upvotes: 4

Related Questions