I'm trying to pipe different LSP Servers over HTTP (to put it in docker and run in a more isolated way). But after some hours trying I stopped in a final error for my actual knowledge (and being here for my first post)
At this point I'm trying run clangd
using socat
command to listen STDIN and send input to another socat instance also running locally but listening on HTTP and passing commands to clang
command of first socat:
socat TCP-LISTEN:8899,fork,reuseaddr EXEC:"clangd -log=verbose --background-index --limit-results=500 --limit-results=500",pty,echo=0
command of second socat:
socat STDIN TCP:localhost:8899
this command is executed by LSP Client (Kate for me) and want to connect with above socat
Note: clangd show a error log showing that json malformed errors:
E[22:25:24.094] JSON parse error: [103:0, byte=3165]: Expected , or } after object property
E[22:36:44.751] Transport error: Got signal, shutting down
the full log:
# socat TCP-LISTEN:8899,fork,reuseaddr EXEC:"clangd -log=verbose --background-index --limit-results=500 --limit-results=500",pty,echo=0
clangd is a language server that provides IDE-like features to editors.
It should be used via an editor plugin rather than invoked directly. For more information, see:
https://clangd.llvm.org/
https://microsoft.github.io/language-server-protocol/
clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.
I[22:25:24.094] clangd version 15.0.7
I[22:25:24.094] Features: linux
I[22:25:24.094] PID: 26477
I[22:25:24.094] Working directory: /home/xxxxxxxx
I[22:25:24.094] argv[0]: clangd
I[22:25:24.094] argv[1]: -log=verbose
I[22:25:24.094] argv[2]: --background-index
I[22:25:24.094] argv[3]: --limit-results=500
I[22:25:24.094] argv[4]: --limit-results=500
V[22:25:24.094] User config file is /home/xxxxxxxx/.config/clangd/config.yaml
I[22:25:24.094] Starting LSP over stdin/stdout
V[22:25:24.094] <<<
{
"id": 1,
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix",
"refactor",
"source"
]
}
}
},
"completion": {
"completionItem": {
"resolveSupport": {
"properties": [
"additionalTextEdits"
]
},
"snippetSupport": true
}
},
"documentSymbol": {
"hierarchicalDocumentSymbolSupport": true
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
]
},
"inlayHint": {
"dynamicRegistration": false
},
"publishDiagnostics": {
"relatedInformation": true
},
"selectionRange": {
"dynamicRegistration": false
},
"semanticTokens": {
"formats": [
"relative"
],
"requests": {
"full": {
"delta": true
},
"range": true
},
"tokenModifiers": [
],
"tokenTypes": [
"namespace",
"type",
"class",
"enum",
"interface",
"struct",
"typeParameter",
"parameter",
"variable",
"property",
"enumMember",
"event",
"function",
"method",
"macro",
"keyword",
"modifier",
"comment",
"string",
"number",
"regexp",
"operator"
]
},
"synchronization": {
"didSave": true
}
},
"window": {
"workDoneProgress": true
},
"workspace": {
"workspaceFolders": true
}
},
"processId": 25220,
"rootPath": "/home/xxxxxxxx",
"rootUri": "file:///home/xxxxxxxx",
"workspaceFolders": [
]
}
E[22:25:24.094] JSON parse error: [103:0, byte=3165]: Expected , or } after object property
E[22:36:44.751] Transport error: Got signal, shutting down
Tests using typescript-language-server results on no errors, no output, no logs and anything else
Note 2: The JSON is broken (missing last "}") but cannot figure why, and how to solve it