GIT bash as Terminal not working in VSCode - visual-studio-code

For home office I need to setup a whole bunch of things, however I seem to keep running into issues with making git bash work properly in VSCode.
I have installed Git 64-bit Git for Windows.
Initially it didn't work at all until I added the following to my settings.json
"terminal.external.windowsExec": "D:\\SOFTWARE\\Git\\bin\\bash.exe",
"terminal.integrated.shell.windows": "D:\\SOFTWARE\\Git\\bin\\bash.exe"
with the second line saying it is deprecated, but it works none-the-less.
Now it runs but inconsistently. Running just the 'ls' command repeatedly it :
45% of the time won't run
45% of the time states 'segmentation fault'
10% actually work
The git bash app itself runs the commands with zero issues. I have read up multiple posts on 'segmentation fault' and seem no closer to the issue.
What I have tried :
Adding exceptions to AV (only running defender ATM)
re-installing git multiple times with admin rights to main and secondary drives
Win10 safe-mode installation
restarts before and after installations and installs
installing older versions of Git.
adding '*\Git\bin' to environment variables
I am really at a loss here and it works fine at the office. Perhaps I am missing something obvious.
Any help would be appreciated.

I found what I needed.
I needed to add in the settings.json file the following code :
"terminal.integrated.env.windows": {
"PATH" : "D:\\SOFTWARE\\Git\\bin\\bash.exe"
}
Having done that I thought I could remove the previous deprecated code :
"terminal.integrated.shell.windows": "D:\\SOFTWARE\\Git\\bin\\bash.exe"
But it seems it still was required.
I hope this helps someone as most of the references out there (that I could find) refers to the older deprecated code.
Note : seems now my 'vagrant' and 'npm' command wont run at all anymore

Related

Elixir: VS Code ExUnit cannot find Mix

I cannot load or run my tests, from within VS Code.
I'm a new user to Elixir, and to VS Code. I'm running Lubuntu 21.10 (Impish). I've downloaded Erlang/OTP 25 (.deb), and Elixir 1.14 (precompiled binary in /usr/share/elixir), and can get anything I need running in a Bash terminal. Again, in a standard QTerminal window,
erl, iex, mix, elixir, etc. all work fine.
In VS Code, however, I get some errors. I feel stupid, but I'm coming from Sublime Text, so please forgive me.
In the left pane of VS Code, ExUnit shows an error (red):
Clicking on this error gives me this, on the bottom right pane. The command line options, passed to mix test, seem to be the default configuration:
This result is bizarre to me, because I can open the integrated terminal, execute /bin/sh, and then run the exact mix test line that's displayed:
/usr/share/elixir/bin has been added to my PATH variable, in ~/.bashrc, ~/.profile, and /etc/environment.
However, I am further confused by all tests being excluded, and wonder if there's some connection to the core issue:
Note that I can run my tests just fine, using different command line options. I've tried adding tags, but that didn't fix the problem.
I tried Google'ing this, and played around with my settings. Here is what I have configured in the "User" settings.json, and I made sure nothing overrides this in "Workspace" settings:
Changing the useNativeTesting setting doesn't solve the problem.
On another (?) note, I get a "failed to run elixir" upon VS Code startup:
Again, I have no problem running commands from a Linux terminal, or from a terminal within VS Code.
Plot twist: If I remove the precompiled Elixir 1.14, and downgrade to an older version, via apt, the problem goes away. But Lubuntu 21.10 doesn't offer Elixir 1.14, and I'm really into using the new dbg() feature.
But for now, I cannot load or run my tests, from within VS Code, apparently because Mix cannot be found.
Thanks to Daniel Imms, from the VS Code team, for answering my question on Twitter:
"Try moving where ever you init mix and elixir (.bashrc?) into your .bash_profile and then logging out and in again or restarting. I'm guessing it's in your bashrc which doesn't run in non-interactive sessions like in tasks."

Fish seems to remember things through reinstallation

I'm trying to troubleshoot something with fish shell, so I uninstalled it from my Mac, including deleting everything from ~/.config/fish and reinstalled it. I found that it seems to remember some things, such as its autocomplete history. Is there some file I've missed in the uninstall process? Or is fish sharing autocomplete/history data with zsh?
The documentation says:
By default interactive commands are logged to $XDG_DATA_HOME/fish/fish_history (typically ~/.local/share/fish/fish_history)

Terminal started behaving badly when Zshell theme is present

Originally from here.
Versions:
VSCode Version: 1.46.1
OS Version: Windows_NT x64 10.0.20161
Steps to Reproduce:
Install debian-dev-boilerplate inside WSL.
Setup powerlevel 10k.
Clone a git repo and enter its folder.
git clone git#github.com:DanielAtKrypton/debian-dev-boilerplate.git
cd debian-dev-boilerplate
You should now see something like:
Open vscode from zshell. By typing at the zshell prompt:
code .
At this point the bug is revealed when the terminal is opened for the first time inside vscode. At first glance, the terminal renders correctly the powerlevel10k theme. After half a second, the theme is deactivated as can be seen in the next picture.
Does this issue occur when all extensions are disabled?:
Yes. The first time vscode is launched, it installs a vanilla (with no extensions) vscode-server to the linux distro. And still the bug happens.
It is interesting to note that in prior vscode versions this functionality was working alright. For any reason I don't know this issue started to happen in the last couple weeks.
Additional Info:
Here is the log file when running the commands:
code . --log trace
exthost.log
Most likely Powerlevel10k has been installed and/or loaded from ~/.zshrc incorrectly. The screenshot of VS Code shows robbyrussell theme, so I surmise that you are using Oh My Zsh. To install Powerlevel10k on top of Oh My Zsh you need to follow these instructions:
Run: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
Try running grep -E 'ZSH_THEME|/powerlevel10k' ~/.zshrc. The output must be exactly like below.
ZSH_THEME="powerlevel10k/powerlevel10k"
If it's not, you need to fix ~/.zshrc.

vscode is not lauching for me on windows 7

I downloaded the latest ZIP file of VSCode for windows from VSCode website.
Unzipped it and tried running the Code.exe from it. It does nothing no crashing message juts output nothing.
I tried running Code.exe from command prompt [after CD to the directory where I have unzipped it], nothing happens, no out put.
Then I did some googling to do more troubleshooting and found out I need to run Code.exe or bin\code.cmd with --help and --verbose command.
No output on command line.
I am totally confused and don't know how do I make VScode work on my windows 7 machine or how do I troubleshoot why its not working.
I have appropriate .Net Framework installed [the one suggested by the VSCode website].
I have also tried installer , with all above debugging steps , same outcome as above.
I checked the code.exe in task manager to see if its running in background, nothing in there too.
What do I do ?
Check if the process is running in Task Manager.
Check for "code.exe". If it is running, then end all instances, and try again.
Otherwise, try opening event log, in Application or System. Look for errors or warnings which may have been logged and give some insight into why Code didn't open.
So guys seems like new version of VSCode has this problem.
Try downloading an older version of VSCode and do not upgrade it once its installed.
After I installed : V 1.18.1 , its working fine.

VSCode Powershell integrated terminal hangs when starting

I am using VSCode version 1.12.2 in Windows 10 x64 build 16193. I am trying to debug Powershell in VSCode, but I cannot get the PowerShell Integrated Terminal working. Every time I started the terminal, here's what I see:
And then it hangs in that stage. I can still debug, start, step in, step out..., but I cannot view my variable or run any expression.
My VSCode is using powershell x64 here:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
So this is a known issue with this version of windows 10. Workaround here: https://github.com/PowerShell/vscode-powershell/issues/742
It's possible it's getting stuck on something while loading your profile(s). Try adding this to your settings to skip this:
"powershell.enableProfileLoading": false
I have had a similar problem, it seems. I cannot be sure it is the same, but when I would "load a file with VSCode" (user installer confirmed, system installer unconfirmed), it would hang. The following avenues tested:
Double-clicking on a PS1 file (the association to Code being made)
Starting VsCode empty and then loading the file
Starting VsCode from the command-line with a file-designation parameter
Using the --verbose switch, I got a listing which lead me to believe that VsCode seemed to be checking on updates using NPM (I could be wrong here).
Whatever the underlying problem, I did a lot of prodding and probing, and the cure I found was this.
Delete the directory called C:\Users\YourUserId\.vscode.
This directory is rather large, is not wiped by software removal, and may be corrupted apparently. After deleting it, the problem disappeared.