Skip to content

Commit

Permalink
docs: add tip for conditional shims using TERM_PROGRAM (#2770)
Browse files Browse the repository at this point in the history
* docs: add tip for conditional shims using TERM_PROGRAM

* fix: formatting
  • Loading branch information
htunnicliff authored Oct 17, 2024
1 parent aba9ae5 commit 6996e33
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/ide-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,35 @@ end
This assumes that `mise` is on PATH. If it is not, you'll need to use the absolute path (
e.g.: `eval "$($HOME/.local/bin/mise activate zsh)"`).

:::: tip
Conditionally using shims is also possible. Some programs will set a `TERM_PROGRAM` environment
variable, which may be used to determine which activation strategy to use.

Here is an example using VSCode:

::: code-group

```zsh
# ~/.zprofile
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
eval "$($HOME/.local/bin/mise activate zsh --shims)"
elif; then
eval "$($HOME/.local/bin/mise activate zsh)"
fi
```

```bash
# ~/.bash_profile or ~/.bash_login or ~/.profile
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
eval "$($HOME/.local/bin/mise activate bash --shims)"
elif; then
eval "$($HOME/.local/bin/mise activate bash)"
fi
```

:::
::::

This won't work for all of mise's functionality. For example, arbitrary env vars in `[env]` will
only be set
if a shim is executed. For this we need tighter integration with the IDE and a custom plugin. If you
Expand Down

0 comments on commit 6996e33

Please sign in to comment.