Logging LSP traffic


Is there a way to log LSP traffic between Theia and a language server?

If it helps, the language server I’m working with has an option to log the traffic to standard error, so if Theia has a way of logging the server’s standard error somewhere, that would be sufficient.



[original thread by Nathan Ridge]

AFAIK, there is no generic way to do this, but if you control the LS, you can convert the logged strings to logMessage notifications as we do in yangster. See https://github.com/theia-ide/yang-lsp/blob/04c4a04c4d95e75e5492e691326bb4208fda8b74/yang-lsp/io.typefox.yang.diagram/src/main/java/io/typefox/yang/diagram/YangServerLauncher.xtend#L105

[Nathan Ridge]

Thanks, although at that point I might as well just modify the server to log the messages to a file rather than standard error.

There should be a preference for each language server to enable tracing to the output view.

but then as Jan mentioned it depends on how good LS at logging errors