Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 286
Juan Tarquino Avatar asked Aug 31 '25 01:08

Juan Tarquino


1 Answers

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

like image 167
Juan Tarquino Avatar answered Sep 02 '25 13:09

Juan Tarquino