How to manually restart an extension in VSCode? - visual-studio-code

I just allowed an update to the PowerShell extension, and I'm now presented with this notice:
PackageManagement updated. If you already had PackageManagement loaded in your session, please restart the PowerShell extension.
I would love to know how to do this. I imagine a full VSCode restart would do the trick, but curiosity has got the better of me here. Someday I might need to do this without interrupting other work in progress.
Apparently it can be accomplished programmatically, but before we go there it'd be nice to know how to do it manually.
On the Manage menu for the extension, we have the Disable and Uninstall items:
...but no Restart.
Can this be done?

Not sure how to do that programmatically, but you can restart the PowerShell session by opening the "PowerShell Session Menu" and then click "Restart Current Session". See below:

I was wondering the same thing for the powershell extension, and by poking around I found a potential solution (more of a workaround honestly):
Hit the "Kill terminal" button (trashbin icon)
KillTerminal (requires killing all active terminals)
The following dialogue appears, click "Yes" to restart it:
RestartDialogue
I confirmed too that the version did update: UpdateConfirmed

Press Ctrl + Shift + P to Open Command Palette and Type Restart Extension Host

Related

Can't open VSCode from command-line WSL ZSH

So I decided to quit dual-boot and start using WSL. I'm having a problem and really can figure out how to fix it.
I simply can't open VSCode using the code command from the terminal when using an external terminal. When using the integrated, a command like "code ." works just fine.
Anyone knows how to fix it? It was working good a few steps of setup ago, but I lost track and don't exactly when that happened. I'm currently using HyperJS as terminal and my integrated terminal is already running zsh and it works when the VSCode is connected to WSL and when it isn't aswell.
Anyway, hoping for a fix, 'cause I'm really lost.
Thanks!
It's fixed and it was an easy fix, but it took long for me to realize that all I had to do was one step.
Here's the thing: the command "code" on the integrated terminal was working like a charm because the VSCode itself was running as administrator on Windows.
My Hyper wasn't running as administrator, so all I did was:
Right-click on HyperJS icon and go to the properties of the application
Switch to "Compatibility" tab
Check the "Run as administrator"
It's working without a problem now. Took me a while to realize that, but it's all good now.

How to undo "Don't show this prompt again" in vscode python?

Accidentally selected "Don't show this prompt again" when prompted to install Pylint in VSCode Python. How should I undo/reset the action so the prompt will appear again?
See the issue notes here: https://github.com/Microsoft/vscode/issues/24815
You might have to do this:
deinstall Visual Studio Code
delete C:\Users[Username].vscode
delete C:\Users[Username]\AppData\Roaming\Code
or relevant paths on your operating system.
To anyone coming here from Google, if you're looking to reset the "Are you sure you want to move 'file' into 'folder'?" prompt:
On macOS, open /Users/[username]/Library/Application Support/Code/User/settings.json and remove "explorer.confirmDragAndDrop": false.
It's a similar process on Windows and Linux ✌️
Here is how to do it on macOS without uninstalling VS Code or delete globalStorage:
Quit all VS Code instances (Cmd +Q)
Instal SQL Lite browser https://sqlitebrowser.org
Go to: /Users/[user_name]/Library/Application Support/Code/User/workspaceStorage/ => Find the one that associate with your workspace that you previously clicked "Don't show this promt again" (by looking into workspace.json and identify the name)
Open stage.vscdb file with SQL Lite
Look for data key "ms-vscode.csharp"
Edit "assetPromptDisabled":true to "assetPromptDisabled":false
Save change
Reopen vs code
https://github.com/microsoft/vscode/issues/24815#issuecomment-547733206

VS Code Terminal Not Allowing Typing

My VS code terminal was working fine, until one day when I tried to work on a project, that was still open in VS code, my terminal didn't allow me to type any commands. I couldn't type anything. This is the screen that I get.
Okay, for those of you struggling with the same problem, I've managed to solve it by clicking on the drop-down menu that says powershell and changing it to cmd.
this happened to me and simply
close vs code
right click on it
run as administrator
open the terminal and it will work
this problem happened when I changed the default path of CMD
For me, I tried using Powershell/CMD/Bash and I was having errors/blank terminal. I found typing echo hello and pressing CTRL + C made it appear. So in fact, everything was working, my terminal was just blank/glitched out, but was really accepting input.
I had a similar issue when running ionic serve command which runs the development server on the localhost. I paid attention after executing the command above, and it said:
Use Ctrl+C to quit this process
Pressing Ctrl+C then displays:
Terminate batch job (Y/N)?
Type Y or y
then the command prompt is shown again!
Here is a sample terminal window - trimmed for brevity:
For who has this problem using React. This happens when you start a live version using npm start. The terminal that handles the live version of the app cannot be used for anything else.
So to continue using the terminal you need to open a new terminal to use in parallel. To do so just click on the plus icon in the top right corner of the terminal panel then choose the "Power Shell" option. This will open a new terminal without restarting visual studio.
In Mac, when working with Python, this helped me: instead of clicking on the "Run Code" option, click on "Run Python file", in the right corner.
For Ubuntu users this is solved by this solution:
File -> Preferences -> Setting -> Features -> Terminal -> Inherit Env
I found two vscode on my desktop, I opened the other one and it worked. Looks like I updated it but the older one didn't disappear.
If typing Ctrl+C can help to get out of this frozen state, that will be easier to do with VSCode 1.64 (Jan. 2022)
The terminal can type the answer for you.
Terminal -- Auto-reply
The terminal is now able to automatically reply when a specific sequences of characters is received.
A good example of where this is useful, which is also the only default case, is the Windows batch script message Terminate batch job (Y/N)? after hitting Ctrl+C when running a batch script.
This typically just ends up causing problems for the user.
The terminal will now automatically reply with Y and enter (\r) which makes Ctrl+C in Windows feel much better.
Pressing Ctrl+C will immediately reply to the question and return to the prompt:
Theme: Sapphire
The feature was made generically so you can setup custom replies for other thing, just be careful when doing this as you are sending text to the process automatically.
For example you could use it to automatically update Oh My Zsh when prompted:
"terminal.integrated.autoReplies": {
"[Oh My Zsh] Would you like to check for updates? [Y/n]": "Y\r"
}
If you use Clink and enable their similar feature, you can disable it in Clink or in VS Code by setting the reply to null to avoid the two features conflicting with each other:
"terminal.integrated.autoReplies": {
"Terminate batch job (Y/N)": null
}
Go to terminal, preferences, settings.
Check "run code in terminal"
Restart VS.
I changed from bash to powershell in terminal first but the command prompt still not shown.
Then I navigate to File -> Perferences -> Settings and it starts working (command prompt shown)
This seems to just be a display problem. It happened to me when I changed my display settings for desktop icon and app scaling settings.
I managed to fix the problem by simply restarting my computer and re-opening VS code
I had the same problem ... In my case just run vs-code as administrator and works

Terminate Keyboard Shortcut for Mulesoft Anypoint Studio

It gets really annoying to have to open the console everytime I want to stop debugging. The preferences map Ctrl+F2 to terminate, but this shortcut doesn't seem to do anything. I've tried remapping it but no luck, any ideas?
UPDATE - Must be an issue with Eclipse. I found this similar question which doesn't mention a solution. You would think there would be some way to bind a shortcut to the terminate command given how often it's used.
Eclipse Terminate Keyboard Shortcut
If your purpose is only: how to stop the project (debugging) without opening the Console, then you can right click on the Canvas and select: stop project [project name]

Aborting an "unclosed" powershell command in Visual Studio Nuget Package manager console

I accidently issued an invalid PowerShell command in the NuGet Package Manager console and locked the console.
The command was
PM> Get-Project -all | Where { $_.ProjectName -imatch "GPEC.Personne }
then the console displayed >> as prompt and I was unable to leave this mode. Closing and reopening the console did not help. (Had to restart VS).
Is there a way to gracefully cancel a wrong command in this case and return to the standard PM> prompt?
Thanks in advance.
Philippe
That appears to be buggy behavior. The >> indicates that syntactically the current command isn't finished. That is, you have opened a double quoted string but haven't finished it. Press the "Clear Console" toolbar button to escape out of this mode.
In the VS console window there's a "Stop Command Execution" button (a red square if enabled). It's next to the "Clear Console" button. The button is only enabled if a command is actually running.
Based on the accepted answer, it seems OP didn't actually need to abort an executing command. But this answer should prove useful to anyone who really does need to abort a command.
It's a simple question, that's already been answered but I think I might have something to add. In terms of clarifying the behavior of the Nuget Console.
This happens when you open a statement with a single/double quotation and don't close it properly or don't close it at all.
Example (Respectively)
Add-Migraion "Add 'Employee' Model'
OR
Add-Migraion "Add 'Employee' Model
The console will assume that you need to break the command into two lines so it will wait for you to finish the command or close the statement on another line by showing this symbol >>. In such case if that happened by mistake all you have to do is type " or ' based on how you opened the statement.
Sometimes you can look in the regular Windows task manager and kill the task. Can be difficult to find though.
I cringe just posting this.
There's a Debuggable Package Manager program installed with Visual Studio (not sure which version this began with).
You will need to manually CD to the correct folder for your project, but it can be more reliable for certain tasks and you can open multiple windows too which can be nice.
And yes - CTRL+C works to terminate the task :-)