-1

When using the LSP provided by microsoft, at client how to generate a requiring json data and send it to the server? And then how to deal with the json data responded by the server?

I've read official documents but didn't find the way. All I want to do is to get the function definition text string instead of just showing it in a "hover". enter image description here

cryyyyy
  • 619
  • 1
  • 6
  • 5

1 Answers1

1

VSCode sends the information to the implemented server for you. For example, the initialize request is sent to the server as soon as the plugin is started on the client-side.

Then, the server would have to build logic to handle the JSON payload sent by the client and return a specific response that conforms to the LSP specifications. I would suggest you turn on tracing in VSCode to see the messages being sent/received by the client and server. For lsp-sample, you can set this setting: "languageServerExample.trace.server": "verbose" in your package.json to enable tracing.

In terms of your question regarding function definition text string, I'm assuming you somehow want this in your client code(?) If this is the case, you would have to extract the function definition string in your hover handler, since that's how the server is sending that information over.