Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSpec JSON format for loading #7
Comments
|
After reading the LSP spec, it seems to me that the spec is designed so that these types can be deduced from reading the parameters.
Therefore, a generic interface for them is enough interface LSPMessage extends Message {
id?: number | string | null;
result?: any;
error?: ResponseError<any>;
params?: any
}However, these more detailed types cannot be deduced, as we don't know if a communication is from client to server, or from server to client. Those can only be determined if you decide a perspective, such as from client side or the server side.
In the docs, I'll make it clear that the log and the visualization are perspectives from the client side. For the types, I think something like this will do: export type LogMessageType =
| 'send-notification'
| 'recv-notification'
| 'send-request'
| 'recv-request'
| 'send-response'
| 'recv-response'
interface LogMessage extends Message {
type: LogMessageType;
timestamp: number; // Unix timestamp
id?: number | string | null;
result?: any;
error?: ResponseError<any>;
params?: any;
}@dbaeumer What do you think? |
|
Also think we should use https://en.wikipedia.org/wiki/JSON_streaming#Line-delimited_JSON for logging. This way it's easy to append to the log. Parsing is also easy - splitting the content by |
|
Actually I would make this a composite not a sub type and would reuse the stuff we have in the jsonrpc module if possible since the definitions need to go into the tracer as well. Something like this: interface LogEntry {
type: LogMessageType;
message: RequestMessage | ResponseMessage | NotificationMessage;
timestamp: number;
} |
|
OK, sounds good. |
|
This is captured by #8 and microsoft/vscode-languageserver-node#366. |
|
This issue was moved to microsoft/language-server-protocol-inspector#7 |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Specify a JSON format which the Inspector could load.
Stay close to the original LSP JSON format, but add useful fields such as timestamp.