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

how are you supposed to install this extension on linux? #35

Closed Luro02 closed 5 years ago

Luro02 commented 6 years ago

I already built the sourcekite dependency and I think it is working, (how do I test it?). I also set my path's according to the readme, screenshot of my settings.json

{
    "swift.path.swift_driver_bin": "/home/lucas/.swiftenv/versions/4.2-CONVERGENCE/usr/bin/swift",
    "swift.path.sourcekite": "/home/lucas/projects/swift/sourcekite/.build/release/sourcekite"
}

but I still don't have linting support. maybe someone can help me? I also attached the built sourcekite binary onto this issue. Thanks in advance :) sourcekite.zip

vknabel commented 6 years ago

Thanks for your report. If you have "Maintained Swift Development Environment" installed and it does not throw any errors when editing Swift files, it should be installed correctly.

but I still don't have linting support.

This extension mostly adds autocompletion. What exactly do you mean by linting?

If you want to test your sourcekite installation run

$ echo "1\n{\nkey.request: source.request.protocol_version\n}\n\n" | /home/lucas/projects/swift/sourcekite/.build/release/sourcekite
1
{
  key.version_major: 1,
  key.version_minor: 0
}

If you will receive an error instead of a valid response as shown above, the testing setup might help you: vknabel/sourcekite/.travis.yml#L82.

Luro02 commented 6 years ago

thanks for the response, my problem is, that I don't see any compiler errors under my code and I also don't have the recommended functions thing. The command above doesn't output anything at all! I built it with the commands, that travis uses. I also built the debug version and it ouputs the following:

|||[main.swift:34] sourcekite - sourcekitd_initialize
|||[main.swift:42] sourcekite - state: endRequest
|||[main.swift:43] sourcekite - input: 1\n{\nkey.request: source.request.protocol_version\n}\n\n
|||[main.swift:44] sourcekite - input length: 57
|||[main.swift:48] sourcekite - wrong format for reqi
vknabel commented 6 years ago

Sorry for the wrong snippet. My ZSH replaced \n with newlines while bash doesn't.

The correct bash command would be:

$ echo "1
{
key.request: source.request.protocol_version
}

" | /home/lucas/projects/swift/sourcekite/.build/release/sourcekite
1
{
  key.version_major: 1,
  key.version_minor: 0
}
Luro02 commented 6 years ago

Edit: inside the logs I get

extensionService.ts:913 Activating extension 'vknabel.vscode-swift-development-environment' failed: Path must be a string. Received undefined.
w._logMessageInConsole @ extensionService.ts:913
vknabel commented 6 years ago

That's weird. I never saw an error like this. Did you try a reinstall?

If it doesn't help, does manually setting swift.path.shell to your bash solve your problem?

Guddler commented 5 years ago

I was having the same problem. I've just installed Swift / VSCode on Linux to experiment and was getting the undefined error when the extension was loading. After poking about in the source I found this:

provideDebugConfigurations(
    _folder: vscode.WorkspaceFolder | undefined,
    _token?: vscode.CancellationToken
): vscode.ProviderResult<vscode.DebugConfiguration[]> {

I found that after creating a Workspace and putting my swift files in it, the extension would then load. I have no idea if by design you are meant to need a workspace (I don't recall reading that you need to) but maybe it is a workaround for now?

vknabel commented 5 years ago

Thank you very much for your feedback!

The snippet you showed is not responsible for this issue. Type annotations in typescript are essentially just comments and have no runtime impact. Additionally the arguments are not used.

I found that after creating a Workspace and putting my swift files in it, the extension would then load.

Interesting! Glad to know that there is a workaround! I will have another try on that.

I have no idea if by design you are meant to need a workspace (I don't recall reading that you need to) but maybe it is a workaround for now?

In theory this should work the same for workspaces and simple folders. And on macOS it does.

vknabel commented 5 years ago

Were you using the debugger from this extension? If so you should better rely on LLDB Debugger as described in https://github.com/vknabel/vscode-swift-development-environment#debugging.

mvdve commented 5 years ago

Just to confirm, after adding my project folder to a workspace, the extension works. Otherwise i get an undefined error.