Pure-D / serve-d

D LSP server (dlang language server protocol server)
MIT License
200 stars 48 forks source link

kate editor unable to initalize serve-d since v0.8.0-beta.1 #305

Closed joebonrichie closed 1 year ago

joebonrichie commented 1 year ago

The Kate editor is unable to initialize serve-d v0.8.0-beta.1 to v0.8.0-beta.13. v0.7.4 is okay.

serve-d is using a stand-alone version of dcd 0.15.2, commit c336004ed8c829840acc736918542242971cc4ba also tested.

Using kate 22.12.1 and KF5 5.101.0

Kate gives the following:

[22:16:14  LSP Server Log] d@/home/ninya/sos/moss
serve-d standalone v0.8.0-beta.13
Included features: "d", "workspaces"
Built: Mon Mar 13 22:13:29 2023
with compiler Digital Mars D v2.100 on linux x86_64
dub, dfmt and dscanner are bundled within (compiled in)
2023-03-13T22:16:14.948 [error] jsonrpc.d:543:run Got invalid request '{
"id": 1,
"jsonrpc": "2.0",
"method": "initialize",
"params": {
"capabilities": {
"textDocument": {
"codeAction": {
"codeActionLiteralSupport": {
"codeActionKind": {
"valueSet": [
"quickfix",
"refactor",
"source"
]
}
}
},
"documentSymbol": {
"hierarchicalDocumentSymbolSupport": true
},
"hover": {
"contentFormat": [
"markdown",
"plaintext"
]
},
"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
}
},
"processId": 1124275,
"rootPath": "/home/ninya/sos/moss",
"rootUri": "file:///home/ninya/sos/moss"
}
}
'!
joebonrichie commented 1 year ago

Bisected between https://github.com/Pure-D/serve-d/commit/4fb7a5546acd6e7b99eb85a1ae6354ce72851409 (good) and https://github.com/Pure-D/serve-d/commit/5845c6975d3c4310b63e67b5ed04d17c05331b0a (bad)

This leaves three commits as the culprits https://github.com/Pure-D/serve-d/commit/a757a32e301fd6fa7be5bdbf8b727066cab5b9e0 https://github.com/Pure-D/serve-d/commit/eecbc7f7796302b86e49ed1592776f5ac52509ce https://github.com/Pure-D/serve-d/commit/32f602d9417f11b8838c70291720d68401b33e88

WebFreak001 commented 1 year ago

can you enable trace logging (start serve-d with --loglevel trace) and share the LSP output again? It does not seem to be anything related to JSON parsing, but rather something inside some handling method

WebFreak001 commented 1 year ago

Oh from the error message it looks like kate sends a trailing whitespace to the JSON request, I pushed a commit to strip off a single trailing new-line from JSON-RPC requests, can you try with the current nightly build to see if this fixes your issue? (https://github.com/Pure-D/serve-d/releases/nightly)

It's building right now and will be available in ~15 minutes. You can also build serve-d yourself if you have a reasonably beefy machine with at least ~8 GB of RAM, by running dub build after cloning.

joebonrichie commented 1 year ago

Thanks for the timely response. Confirmed that https://github.com/Pure-D/serve-d/commit/4b61b86a051c7e22e5024077c88c615d69145ba5 fixes the issue! Many thanks :+1: