Skip to content

[Solved] Activating extension 'sswg.swift-lang' failed: Cannot find swift executable.. #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cntrump opened this issue Mar 30, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@cntrump
Copy link

cntrump commented Mar 30, 2022

vscode-swift not works, but another SourceKit-LSP is fine.

To Reproduce
Steps to reproduce the behavior:

  1. Ctrl + Shift + X, install vscode-swift extension
  2. Sourcekit-lsp:Toolchain Path -> /opt/swift-toolchain/usr
  3. Open a SPM workspace contains Package.swift
  4. Runtime Status of Swift extension: Not yet activated
  5. Ctrl + Shift + I, Open Toggle Developer Tools, see error:
    Activating extension 'sswg.swift-lang' failed: Cannot find swift executable..
    

Expected behavior
vscode-swift activated automatically when I open Swift workspace.

Environment

  • OS: Ubuntu Desktop 20.04 arm64
  • Swift version:
    Swift version 5.6 (swift-5.6-RELEASE)
    Target: aarch64-unknown-linux-gnu
    
  • Visual Studio Code version: 1.65.2
  • vscode-swift version: v0.4.1 Preview

Additional context

Download code_1.65.2-1646922911_arm64.deb from https://code.visualstudio.com/download

Install via sudo apt-get --fix-broken install ./code_1.65.2-1646922911_arm64.deb

Install Swift toolchain from https://swift-toolchain.com

@cntrump cntrump added the bug Something isn't working label Mar 30, 2022
@adam-fowler
Copy link
Contributor

Is the swift executable in your PATH? If not you need to set the path in the swift.path config value. You shouldn't need to set the LSP toolchain path after that.

@cntrump
Copy link
Author

cntrump commented Mar 30, 2022

Is the swift executable in your PATH? If not you need to set the path in the swift.path config value. You shouldn't need to set the LSP toolchain path after that.

yes, I have set:

swift.path: /opt/swift-toolchain/usr/bin/swift

sourcekit-lsp.serverPath: /opt/swift-toolchain/usr/bin/sourcekit-lsp

sourcekit-lsp.toolchainPath: /opt/swift-toolchain/usr

@adam-fowler
Copy link
Contributor

swift-path should be /opt/swift-toolchain/usr/bin/. See it's description "The path of the folder containing the Swift executables"
Once you get the swift-path correct you shouldn't need to set the LSP paths

@adam-fowler
Copy link
Contributor

As an aside can you verify that swift is in your $PATH. It should work straight off if it is in your $PATH. Open a terminal in VSCode and type swift --version and see what it returns.

@cntrump
Copy link
Author

cntrump commented Mar 30, 2022

swift-path should be /opt/swift-toolchain/usr/bin/. See it's description "The path of the folder containing the Swift executables"
Once you get the swift-path correct you shouldn't need to set the LSP paths

works! thanks for help me 😀

@cntrump cntrump closed this as completed Mar 30, 2022
@cntrump cntrump changed the title Linux Aarch64: Activating extension 'sswg.swift-lang' failed: Cannot find swift executable.. [Solved] Activating extension 'sswg.swift-lang' failed: Cannot find swift executable.. Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants