swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
736 stars 51 forks source link

Extension doesn't start on Fedora Asahi Linux Arm64 #644

Closed janvhs closed 9 months ago

janvhs commented 10 months ago

Describe the bug The LSP won't start on Linux arm64. It shows the following message:

Activating Swift extension failed: Failed to find swift executable

and shows the stack trace:

2023-11-28 17:42:11.599 [info] ExtensionService#_doActivateExtension sswg.swift-lang, startup: false, activationEvent: 'workspaceContains:Package.swift'
2023-11-28 17:42:11.620 [error] Activating extension sswg.swift-lang failed due to an error:
2023-11-28 17:42:11.620 [error] Error: Failed to find swift executable
    at $x (/home/jan/.vscode/extensions/sswg.swift-lang-1.7.0/dist/extension.js:75:8119)
    at async v.n (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:124:6205)
    at async v.m (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:124:6168)
    at async v.l (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:124:5625)

To Reproduce Steps to reproduce the behavior:

  1. Install the extension
  2. See error

Expected behavior Start the LSP.

Environment

Additional context Keep in mind that I am on a MacBook Air running an arm64 Linux version.

adam-fowler commented 10 months ago

If you open a terminal inside VSCode and type /bin/sh -c "LCMESSAGES=C type swift" what is the output?

janvhs commented 9 months ago

Sorry, for the late response. It's the following:

$ /bin/sh -c "LCMESSAGES=C type swift"
swift ist /usr/bin/swift

I installed VSCode and Swift as RPM packages.

janvhs commented 9 months ago

Setting "swift.path": "/usr/bin" resolved the issue. Autodetection doesn't work, although I'm not sure if it is supposed to.

adam-fowler commented 9 months ago

Sorry that was a typo what happens when you call.

/bin/sh -c "LC_MESSAGES=C type swift"

It should return its output in English so I have a consistent language to parse.

janvhs commented 9 months ago

It's basically the same:

swift is /usr/bin/swift

Is auto-discovering the Swift executable a supported feature?

adam-fowler commented 9 months ago

Ah it's different. This time it is in English.

The latest release of the extension shouldn't need you to set the path anymore.

janvhs commented 8 months ago

Super random and hope you do not mind the ping, but thanks @adam-fowler for teaching me the LC_MESSAGES trick. I used it several times since you taught me its existence. It is really handy!