Skip to content

Detect if Swiftly is installed, but not being used #1690

Open
@plemarquand

Description

@plemarquand

In order for Swiftly to be picked up ~/.swiftly/bin must appear in the $PATH. The Swiftly install process creates a .bash_profile or .zprofile file that essentially does:

if [[ ":$PATH:" != *":$SWIFTLY_BIN_DIR:"* ]]; then
    export PATH="$SWIFTLY_BIN_DIR:$PATH"
fi

This prepends Swiftly to the path if it doesn't exist, however if the $PATH already contains the SWIFTLY_BIN_DIR but it appears after /usr/bin then the system swift will be picked up instead.

Additionally, because .zprofile/.bash_profile are only run with login shells it is possible for this script to not run when VS Code is opened, if its opened via the Explorer/Finder/Dock/Spotlight etc. This is because VS Code doesn't necessarily launch with a login profile (see Shell Arguments in https://vscode-docs1.readthedocs.io/en/latest/editor/integrated-terminal).

If it is opened with terminal it will inherit the terminal env vars.

The VS Code extension should check to see if the swiftly path is present in $PATH but superseded by /usr/bin, and if so warn the user. It could recommend they configure VS Code to use a login shell, i.e:

"terminal.integrated.profiles.osx": {
  "zsh (login)": {
    "path": "zsh",
    "args": ["-l"]
  }
},
"terminal.integrated.defaultProfile.osx": "zsh (login)"

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions