Use bash instead of Powershell in VS Code terminal

On Windows, selecting the nRF Connect terminal within VS Code seems to start up Powershell. Is there a way to configure it to use bash instead?

I'm currently just launching bash from the toolchain manager, but it would be nice to be able to easily use it from VS Code as well.

Thanks!

Parents
  • Hi,

    What do you want to do from bash, use west?

    If it's just starting bash then you can choose the terminal by clicking the arrow in the right of the terminal window:

    regards

    Jared

  • I'd like to have the same environment as when I choose "open bash" from the Toolchain Manager of nRF Connect Desktop. Essentially a bash shell with the nRF Connect environment set up.

    I have several build scripts written in bash, but I also just prefer using bash to powershell. Slight smile

    In Linux, selecting the nRF Connect terminal option in VS Code does provide a bash shell with the nRF Connect environment ready to go. I'm hoping to achieve the same thing on Windows.

  • Hi Jared,

    Thanks for pointing that out! The comment below the suggested solution says that it won't work on any SDK greater than 2.0.0, and that seems to be the case with 2.4.0 which I am using. Launching git-bash.exe does not set up the Zephyr SDK automatically, so I guess some extra work is involved.

    Also, it doesn't mention anything about setting it up in VS Code.

    The toolchain manager does indeed work for me, but I'm looking to have this work specifically from the "nRF Connect" choice in the VS Code terminal.

    I suppose I could figure out how to add a custom terminal to VS Code, and reverse engineer how the toolchain manager launches it's environment, but that seems like a lot of work. Also, I'd have to add an entry for each toolchain I use (and I use several because I work on many projects), whereas I believe the "nRF Connect" option uses the configured environment.

    If this isn't supported, how can I go about adding a feature request? It would be nice to configure the VS Code "nRF Connect" terminal to use Powershell or bash.

    Thanks again!

  • Hi,

    Let me discuss this with our VS Code developers and see what they suggest,

    I'll be back,

    regards

    Jared

  • Hi,

    Doesn't quite open bash but you're able to run west if you do: In vs code, press Ctrl+Shift+P and select 'nRF Connect: Open Toolchain Terminal Profile.

    I guess you still want to start bash instead of cmd to run your bash scripts?

    Still waiting for reply from our developers,

    regards

    Jared 

  • Thanks for checking!

    Yeah, I'd still like it to start a bash shell so I can easily run the scripts.

    Hopefully the developers can provide a solution.

    In the mean time, I'll stick to a separate bash window from the Toolchain Manager. Slight smile

  • From our VS Code extension devs:

    When executing “nRF Connect: Open Toolchain Terminal Profile”, the user’s default terminal profile is used. 

    So, to open a bash, users can change that profile, e.g. by using the “Terminal: Select Default Profile” command. If they select “Git Bash” there (assuming they are on Windows and have that installed) then they can launch a bash within VS Code which has the right env setup.

    Everything is possible to configure in VS Code regarding shell, you can select which shell should be the default, you can use nRF Connect profile that applies the toolchain environment on top of the default shell.

     However there's a catch: https://github.com/microsoft/vscode/issues/200558

    VSCode 1.85 broke custom execution when the default profile is altered, and all our build and flash tasks are based on this feature. Microsoft neglected to fix this so far,

Reply
  • From our VS Code extension devs:

    When executing “nRF Connect: Open Toolchain Terminal Profile”, the user’s default terminal profile is used. 

    So, to open a bash, users can change that profile, e.g. by using the “Terminal: Select Default Profile” command. If they select “Git Bash” there (assuming they are on Windows and have that installed) then they can launch a bash within VS Code which has the right env setup.

    Everything is possible to configure in VS Code regarding shell, you can select which shell should be the default, you can use nRF Connect profile that applies the toolchain environment on top of the default shell.

     However there's a catch: https://github.com/microsoft/vscode/issues/200558

    VSCode 1.85 broke custom execution when the default profile is altered, and all our build and flash tasks are based on this feature. Microsoft neglected to fix this so far,

Children
Related