3

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?

Gama11
  • 31,714
  • 9
  • 78
  • 100
Juan Tarquino
  • 967
  • 7
  • 13
  • In addition to the example implementation given, there is also minimal documentation in the [Language Extension Guidelines](https://code.visualstudio.com/docs/extensionAPI/language-support#_help-with-function-and-method-signatures) and in the [vscode namespace API](https://code.visualstudio.com/docs/extensionAPI/vscode-api). – mtbrown Aug 30 '17 at 07:12

1 Answers1

3

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

Juan Tarquino
  • 967
  • 7
  • 13