vknabel / vscode-swift-development-environment

New home of Swift Development Environment for VS Code
https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-swift-development-environment
Apache License 2.0
175 stars 14 forks source link

Wrong format for Request Id #26

Closed vknabel closed 6 years ago

vknabel commented 6 years ago

Issue originally reported by @dcartman in https://github.com/vknabel/vscode-swift-development-environment/issues/12#issuecomment-394492671

I'm running on macOS, swift 4.1, compiled source kite with swift 4.1, updated to most recent version of MSDE (2.4.3).

Pointing at the debug build of sourcekite I am getting these errors:

/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/out/src/server/sourcekites.js:88
throw new Error("wrong format for reqid");
^

Error: wrong format for reqid
at SourcekiteResponseHandler.handleResponse (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/out/src/server/sourcekites.js:88:23)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at Pipe.onread (net.js:560:20)
[Info - 1:39:54 PM] Connection to server got closed. Server will restart.
[Error - 1:39:54 PM] Request textDocument/hover failed.
Error: Connection got disposed.
at Object.dispose (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/main.js:825:25)
at Object.dispose (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-languageclient/lib/client.js:57:35)
at LanguageClient.handleConnectionClosed (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-languageclient/lib/client.js:1983:42)
at LanguageClient.handleConnectionClosed (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-languageclient/lib/main.js:126:15)
at closeHandler (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-languageclient/lib/client.js:1970:18)
at CallbackList.invoke (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/events.js:71:39)
at Emitter.fire (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/events.js:135:36)
at closeHandler (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/main.js:221:26)
at CallbackList.invoke (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/events.js:71:39)
at Emitter.fire (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/events.js:135:36)
at IPCMessageReader.AbstractMessageReader.fireClose (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/messageReader.js:135:27)
at ChildProcess. (/Users/daniel/.vscode/extensions/vknabel.vscode-swift-development-environment-2.4.3/node_modules/vscode-jsonrpc/lib/messageReader.js:253:61)
at emitTwo (events.js:111:20)
at ChildProcess.emit (events.js:194:7)
at maybeClose (internal/child_process.js:899:16)
at Socket. (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at Pipe._handle.close [as _onclose] (net.js:510:12)

Before updating the latest version of MSDE, autocompletion was not presenting any results or errors.

If I run sourcekite from the command line, I'm getting this output:

~/Repos/sourcekite/.build/x86_64-apple-macosx10.10/debug/sourcekite
|||[main.swift:34] sourcekite - sourcekitd_initialize
1
|||[main.swift:42] sourcekite - state: endRequest
|||[main.swift:43] sourcekite - input: 1
|||[main.swift:44] sourcekite - input length: 1
vknabel commented 6 years ago

Just to be sure: you didn't install any beta, right? Does it solve your problem when you compile sourcekite with -c release?

dcartman commented 6 years ago

Thanks.

Compiling with '-c release' fixes the error, and I'm now seeing autocompletion and source comments for built-in classes, and classes in my project.

Is source kite supposed to be reading through the swift package dependencies?

vknabel commented 6 years ago

Great to that this worked for you!

Sourcekite just manages the communication between the vscode extension itself (written in typescript) and Apple’s SourceKit. In order to get all information about the SPM project, the vscode extension executes swift package describe --type json