so i’ve been trying for a while to find a solution to #365, but so far i have not found a way to avoid hardcoding paths in devcontainer.json
:
"settings":
{
"swift.path": "/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-08-15-a/usr/bin",
// needed to suppress vscode-swift warning
"lldb.library": "/home/ec2-user/.swiftenv/versions/DEVELOPMENT-SNAPSHOT-2022-08-15-a/usr/lib/liblldb.so"
}
superficially, the extension will not complain if $SWIFT_VERSION
is substituted for the toolchain tag in the settings, but sourcekit-lsp will not work if the path contains environment variables. so swiftenv is effectively non-functional.
has anyone got a workaround?
What happens if you don't set swift.path
? Is it just the issue with finding the LLDB library you are experiencing?
without swift.path
, it just fails with the classic
Failed to setup CodeLLDB for debugging of Swift code.
Debugging may produce unexpected results.
Error: "LLDB failed to provide a library path"
adding swift.path
was the workaround suggested in can’t set CodeLLDB library path · Issue #365 · swift-server/vscode-swift · GitHub
Forgot even after you have set the path it still needs to check everytime you start up just in case you changed it.
Anyway this might help Get correct swift path from swiftenv by adam-fowler · Pull Request #396 · swift-server/vscode-swift · GitHub.
1 Like
thank you!! this is going to save me a lot of time manually updating devcontainer.json
s all the time
Version 0.8.0 of the swift extension has just been released which adds support for finding the swift executable and related exe's when installed with swiftenv
. You shouldn't need to set the swift path anymore
2 Likes
can confirm it is working now, thanks!