-
Notifications
You must be signed in to change notification settings - Fork 107
Logging JSON RPC messages #449
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
Comments
This is something that I haven't yet addressed. Currently the raw messages are transformed into "Renor" (Request, Error, Notification or Response) objects as they come through the pipe and routed. Same for the other side the responses are serialized shoved out the door as quickly as possible. I can look at adding the ability to log the messages out with the next version. My current thinking is some optional interface you can implement and provide an implementation of. On the vscode side you can enable that setting and vscode will emit all the events and responses, I'm not sure if that is what you're after however. |
I see, thanks for your help. So ideally what I am after is something in the format of this comment from Issue #259. If this can be done on the vscode side, maybe I am just doing it wrong because I thought I had enabled the setting already. Anyway, I was able to get some information printed yesterday and I think what I'm seeing is these "Renor" objects. Here's an example of a hover request: This was nice and shed some light onto what is happening, but is a bit difficult to read and doesn't tell you very much about the content of the objects being recieved from/returned to the client. So I think an optional Interface would be a great idea. While I have you here, I hope I can ask another question. The reason I want to see these messages in the first place is that my semantic tokens are flickering just like in this vscode issue. This comment from that same thread gives some insight into what is happening, which is that returning undefined to the client will cause flickering. But from what I can tell I am still returning a SemanticTokens object just like normal, even on the calls that result in flickering. The only difference seems to be that the length is much shorter, for example, in one case I jump from a length of 320 on average down to 185 when the flickering occurs. I am not even totally sure if this is the problem but its about all I know about it. Have you had this experience as well or do you possibly know what it could be? |
I have not had that experience, but maybe @TylerLeonhardt might have some insight? The powershell guys have been using it more than me at this point. |
Unfortunately, I'm not aware of any flickering :/ keep in mind that, when you enable the setting with "verbose" that doesn't update the logs displayed on the server side. It updates the logs displayed client side in the Output pane of vscode. |
I had the same question before. I figured it out by following the Language Server Extension Guide. Note that the
In this example, the |
Hello, I hope this is the right place to post this. If not, I apologize and please point me in the right direction.
I have been using this (great) implementation to build a language server that communicates with a vs code extension that uses the vscode-languageclient package. I am using version 18.1 of the server and 7.0.0-next.12 of vscode-languageclient.
I have implemented about 10 handlers and all is good but I've still never figured out how I can print the actual JSON RPC messages that are being sent between my server and my extension project. I can log just fine using Serilog and write to the output window in my extension with the ILanguageServerFacade and ITextDocumentLanguageServer interfaces but only with content I put in as strings, not the JSON RPC messages themselves.
I am not sure if this is something that I do with the ConfigureLogging method in the LanguageServer declaration or if there's another method or what, I can't seem to figure it out. I've gotten this far without it but I would really like to see these messages for a better understanding of the communication between client and server.
I should mention that I followed the Language Server Extension Guide that explained how to create a setting in the extension to set the verbosity of the communication between the server and client and print it, and I have done this and set the setting to "Verbose," but still, I only see my own hard-coded strings from the ILanguageServerFacade, etc. In the screenshot in the link, JSON RPC messages are printed, so I just don't understand. I assume it is because I need to manually configure this somewhere and don't know how..
Any help would be great and an example would be awesome. Thanks ahead for any help and if I need to post any code, I can.
The text was updated successfully, but these errors were encountered: