GitLab wird am Montag, den 31. Januar, zwischen 08:00 und 12:00 Uhr wegen wichtigen Wartungsarbeiten nicht zur Verfügung stehen.

Commit 1054d0d6 authored by Jan Merle's avatar Jan Merle
Browse files


parent c371ed54
# lsp_proxy
Tool for logging communication between an LSP Client and Server.
## Requirements
Works with client/server combinations where the server runs as a child process of the client and communication is done via stdin/stdout
## Usage
Configure `lsp_proxy` as a custom language server binary in your editor of choice with the folowing command line arguments:
Usage: <output_dir> <language_Server_command> [language_server_args]...
Output: communication.txt -> Annotated communication between client and server
server_messages.txt -> Server log messages
client_to_server.txt -> unaltered stream of data from client to server
server_to_client.txt -> unaltered stream of data from server to client
lsp_inspector.log -> log file compatible with Microsoft's LSP Inspector
Attention: old output files will be overwritten
Alternatively, you can use this tool without an editor and type lsp messages directly in your terminal; or read them from a file.
### Use case: Have a look at the communication between existing language clients and servers
The official specification of the LSP can be hard to understand. If you are not sure about something, just use `lsp_proxy` to sniff the communication between someone elses client and server. Then have a look at `communication.txt` in the output directory to get a feel for the protocol. VSCode is a good choice to use as a client in this case, as it is basically driving the development of the protocol.
### Use case: Replay communication from an LSP Client
Use `lsp_proxy` to sniff the communication between an LSP Client and your own or another server and copy `client_to_server.txt` from the output directory to somewhere else. Then use the copied file as input for your language server like this:
$ my_language_server < client_to_server.txt
### Use case: Language Server Protocol Inspector
M$ made a handy tool called __Language Server Protocol Inspector__ that can visualize debug output from certain VSCode language client extensions. It seems like they don't support it anymore, but if you can manage to get it working it can be a great help to analyze the communication between a language client and a language server.
`lsp_proxy` can output log files compatible with their tool. That way you no longer need a VSCode extension to use it. Just open the `lsp_inspector.log` file from the output directory in the inspector.
## Issues
- This was developed as a quick and dirty debug tool and is probably riddled with bugs
- Only works on Linux and has not been tested thoroughly
- Server to client requests and the corresponding responces have not been tested at all
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment