Skip to content

Issues running in VS Code integrated terminal vs Terminal.app on macOS #245

@repentsinner

Description

@repentsinner

I'm running into what appears to be a similar issue as #242 within the VS Code integrated terminal, but everything is fine in Terminal.app. I'm unclear on what the differences are between the VS Code environment (or tmux environment) and Terminal.app. The error message being printed mirrors what @redsuperbat is seeing.

The following commands produce different output in the two environments, specifically for the nvm_current_version variable. I believe I'm up to date on fish/fisher/nvm.

Terminal.app

ritchie@chonkers ~> set -S | grep nvm_current_version
$nvm_current_version: set in global scope, exported, with 1 elements
$nvm_current_version[1]: |v22.17.1|
ritchie@chonkers ~> fish --version
fish, version 4.0.2-gf1456f9
ritchie@chonkers ~> fisher --version
fisher, version 4.4.5
ritchie@chonkers ~> nvm --version
nvm, version 2.2.18
ritchie@chonkers ~>

VS Code.app

ritchie@chonkers ~> set -S | grep nvm_current_version
$nvm_current_version: set in global scope, exported, with 1 elements
$nvm_current_version[1]: |v22.17.1|
$nvm_current_version: originally inherited as |v22.17.1|
ritchie@chonkers ~> fish --version
fish, version 4.0.2-gf1456f9
ritchie@chonkers ~> fisher --version
fisher, version 4.4.5
ritchie@chonkers ~> nvm --version
nvm, version 2.2.18
ritchie@chonkers ~>

config.fish:

set -gx nvm_default_version lts

When conf.d/nvm.fish is loaded by fisher (?), nvm_current_version has already been set by something that VS Code then inherited, and the initial nvm use --silent $nvm_default_version is never executed. if I update that block to the following, everything seems to now work in VS Code and Terminal.app.

if set --query nvm_current_version
    set -e nvm_current_version
end
if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
    nvm use --silent $nvm_default_version
end

I went chasing all over various dotfiles as well as VSCode's settings.json and I don't see where nvm_current_version is being set upstream of fish initialization, and why it would be inherited to VS Code and not Terminal.app.

Is there any issue unsetting nvm_current_version in the conf.d/nvm.fish file? I'm not super clear on initialization order of fish/fisher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions