On MacOS Monterey 12.5 all IDE terminal sessions open at $HOME in stead of project root - visual-studio-code

As usual, not sure what caused the problem. Started laptop as usual.
But now every project i open, opens in $HOME directory instead of start directory, which is project root by default.
Tried vscode, webstorm, intellij - results were the same.
Further investigation have shown, that dragging absolute path to the terminal + enter causes following error:
zsh: permission denied: /Users/<MyName>/Code/Local/Rust/http-server
I have full read/write permissions, i added FullDiskPermissions to all apps that might need them.
Apps with full disk permissions:
I know it sounds like a minor issue, but i code every day and it's really annoying.

It's not actually an answer, i still don't know what solved it. But i somehow managed to resume the old behaviour.
The problem was global, terminal was opening in the wrong path everywhere, even from the Finder.
I reinstalled zsh, oh-my-zsh, volta (node.js version control tool) - so make sure to check if you have any of the following installed.
And after a day torture it suddenly started working as it used to.

Related

Visual Studio Code terminal displaying "sh-3.2$" every time I "Open in Integrated Terminal" instead of the working directory name (Mac OS)

Earlier today I was having an issue where when I would go to open a new terminal or open a file or folder in Integrated Terminal the terminal would be automatically killed within a couple of seconds without me manually killing it. I was confused as to why this was happening because as far as I could tell I hadn't changed my settings.json file in VS Code or User or Workspace settings and everything was running smoothly just minutes earlier. I was able to resolve that issue but I created a new minor inconvenience. Now whenever I open a file or folder in Integrated terminal it displays "sh-3.2$" instead of the current directory I'm in. If I type pwd and press enter it'll of course display the current directory I'm in but I don't want to have to type that a million times moving forward. If somebody could help me fix this issue I'd greatly appreciate it! I read some of the documentation online but I'm a new bootcamp student and I tried following along but it was going over my head. Thanks again!
I was reading a similar Stack Overflow question and they were saying to try and setup/configure my bash shell to have a prompt with path, specifically the PS1 environment variable, but I was confused on how to actually go about doing that.

Failed to connect to the remote extension host server (Error: Handler already set!)

I went to open a repo using Vs Code on a remote ssh host. I can ssh in successfully but when I try to open a repo I get Failed to connect to the remote extension host server (Error: Handler already set!). I've tried un installing and re installing Vs Code. Does anyone have a fix other than switching ides.
avenmore comment helped me:
I started getting this message with v1.57.0 when trying to run a Vue
project. Long story short: I usually have my DEBUG CONSOLE window
docked inside to the right of my TERMINAL (powershell), and upon
opening VSCode it wouldn't be visible and I'd get this message after
building successfully and trying to launch. The work-around is to
close VSCode, navigate to folder
USERPROFILE%\AppData\Roaming\Code\User\workspaceStorage and delete the
contents (notably state.vscdb) and then restart VSCode. The DEBUG
CONSOLE then shows itself again and all is fine unless I dock it again
and close VSCode and there is a good chance of it happening again next
time VSCode is opened. I have stopped docking the window inside the
terminal and it hasn't happened since.
For me what solved this was to go into the 'remote explorer' and clear out the SSH Targets that I already had in there before the upgrade, and then just paste them in again. Now I can connect. For example, a re-pasted SSH command looked like:
ssh -i "/Users/myuseraccount/abc.pem" someuser#ec2-ip-instance1.compute.amazonaws.com
A few days later this stopped working again. I think maybe because my SSH targets config saved what I pasted in as my SSH connection command. It appears "sometimes" if there are any entries in the SSH target config file, that this error occurs.
I find to ensure this error never occurs do
rm ~/.ssh/config
every time before you open Vs Code. Assuming ~/.ssh/config is where your Vs Code is reading its SSH entries from. There is one other place possible under /etc/$somewhere (I dont know where).
Then when you go to your empty SSH Target and hit the (+) button to connect, paste in the entire ssh connection request at the top of this file. I think you have to clear out the SSH targets every time otherwise I get this error coming up again days later.
Try in settings.json add item "security.workspace.trust.enabled": false
Windows, VSCode 1.57.1
I've just remove and added the host again in ssh configuration:
If you are using MacOS, I found a way.
Close Visual Studio Code, delete files in these two folder, then restart Visual Studio Code.
rm -rf $HOME/Library/Application\ Support/Code
rm -rf $HOME/.vscode
I tried all solution on this post, and can't get success. Then cloned another repo on my WSL folder then open, it was fine. So I changed my repo name, then problem gone. Maybe it may dumb solution. But it works me.
You gonna have to change the "debug.terminal.clearBeforeReusing" to true on setting.json. It works for me
I noticed there was a workspace folder in the folder above, deleted that and it resolved the issue
On the remote system, after various things had happened, I did mv .vscode .vscode-old to basically reset the remote .vscode (over ssh). I had also renamed the remote folder for the project -- not sure if that matters. Then I was was able to connect to it again.
I can't be scientific about those "various things that happened", but I'll to list some:
I had created a second project alongside the first and had connected to it - this was for unrelated reasons and preceded the "handler" error
it was then that I had issues connecting to the first one, even though it had worked for months and months without me ever having this Handler already set error -- related to creating the 2nd one? Not sure. The 2nd one worked fine throughout.
I tried File: Open Folder... from the second remote project and opened the first; it opened but got 2 python exception errors in a python extension - unfortunately I can't remember what they were. This could be noise / unrelated. I happen to have both MS python and pylance extensions installed remotely, I think it was the pylance once that was not happy.
during this, I had also renamed the 1st folder which didn't work; I'm not sure if the rename triggered the different behaviour ie python ext errors instead of the "handler" error
I then replaced .vscode in the first remote project (with the new folder name)
... and that was when it worked, with no "handler" error and no complaints from the python extension(s)

zsh (Default PATH?) messed up with mongodb installation

seems to be imposible after hours and hours trying to solve this problem. All my sudo terminal commands are corrupted due to a several path changes, so i ask for help to set the correct environment variables.
Recently I've a failed installation of mongodb, it was my mistake cause the installation was set for mojave and i've changed several times the path (currently in Big Sur).
The problem starts when i created a .bash_profile in my home user folder, with the mongodb installation path after i moved the files .tgz to /usr/local/mongodb.
After i realized that, i note that when i run sudo 'something' in terminal nothing happens. Instead the name of the window in terminal changes from .zsh to 'sudo' 40x60 and nothing happens. This is very bad for me. Appends all of this i've installed the brand new 11.3.1 big sur update and everything crashes sum the fact that every single file is veryfying...can't at least disable gatekeeper via sudo.
In my user home folder i've:
.bash_profile: - export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
.zprofile -
#Setting PATH for Python 3.9 #The original version is saved in .zprofile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
&
.zshrc
with nothing inside, empty lines.
Someone could please provide me the correct paths and commands for each of these files.
I'm only want to have sudo commands again.

Python IDLE refuse to launch

Python Idle recently straight up refuse to launch, launching it from start menu or its own folder does nothing. Repairing and reinstalling does nothing, nor does running it in older versions of windows does anything.
No changes were made to the program before this. It could be due to a windows update but highly doubted it.
normally, I would get error messages or something. But nothing this time, it doesn't even show up in task manager.
Try deleting the idlerc folder in your profile directory.
This should fix the problem
Example folder directory:
C:\Users\your-username

VSCode ran once on install, won't run or install again

I'm running this on Windows 7 SP1 with most (if not all) current patches. I have administrative permissions on this machine.
The first time I ran VSCodeSetup.exe, it ran the installer for several minutes then launched the actual application.
I got called into a surprise meeting, so I closed it thinking I'd look at it again later.
However, when I returned to my computer and tried to launch it, I found no evidence that it was actually installed... no desktop icon, no entry in the start menu, no Explorer integration...
I tried running VSCodeSetup.exe again, but all it does it show the installer screen for a split second, which then vanishes.
Since then, I've tried the suggestions outlined in VSCode Installation Failed - Failed to extract installer to install the application, even going so far as to run Update.exe --uninstall followed by running VSCodeSetup.exe again, but nothing has worked.
I even tried disabling my antivirus software and running the installer again, to no avail.
Does anyone know what I can do to get VSCode working again?
According to the comments and answers to Install VSCode in a specific folder, Visual Studio Code installs itself to %LOCALAPPDATA%\Code on Windows.
While I'm not sure why it didn't register itself with Explorer, I can at least create a shortcut to %LOCALAPPDATA%\Code\bin\code.cmd (with icon %LOCALAPPDATA%\Code\app.ico) to get it working again.
Or remove the directory entirely and run VSCodeSetup.exe to install it again, which still doesn't add Explorer integration... but this time at least the PATH now has code in it.
On windows VSCode is installed as Code.exe and its located in your
C:\Users\<windows-user>\AppData\Local\Code\app-<version-number>\Code.exe
or
C:\Users\John\AppData\Local\Code\app-0.5.0\Code.exe