How can I use the "PowerShell Integrated Console" in VS Code? - powershell

I have the PowerShell extension installed under VSCode. When I open up a PowerShell script, VS Code automatically pops open a "PowerShell Integrated Console" window in my terminal. It's different from the normal PowerShell terminal:
It's better than the default one because keyboard shortcuts like Ctrl+Backspace to delete a word work. But when I try to open one of these fancy terminals myself, the option isn't there:
How can I get one of these improved terminals without opening a script file, and how can I get VSCode to use them automatically instead of the old PS terminal?

Note:
Normally, a PIC (PowerShell Integrated Console) is automatically created the first time you open a PowerShell source-code file for editing in a session.
The instruction below show to how to directly create a PIC, which may also be helpful if you need to restart it after a crash - though you're usually prompted to create a new one when that happens.
Instruction as of v2022.12.1 of the PowerShell extension for VSCode (Visual Studio Code):
Execute the PowerShell: Show Session Menu command from the command palette (Ctrl-Shift-P).
This will create a PIC and show a submenu, which you can simply dismiss with Esc.
Note: If the PowerShell extension was already loaded but the PIC has crashed, choose Restart Current Session from the submenu instead.
Additionally, you may assign a keyboard shortcut to the command, by clicking the cog icon on the right edge of the command palette entry.
Because the PIC doesn't have an external executable entry point you can not define it as a custom shell profile (at least as of VSCode 1.67.1).
GitHub issue #3918 discusses implementing simpler ways to activate / load the PIC on demand as a future enhancement:
Making the PIC show in the list of available shells (as shown in your question, analogous to the extension-contributed JavaScript Debug Terminal entry) is one of the suggestions, but the concern is that there can only be one PIC as of this writing, so such an entry would behave differently from other shells in the list, which create a new session every time.
However, this concern would go away if support for multiple PICs were to be implemented, which is being proposed in GitHub issue #2418.

Related

iterm annoying history window

I have recently changed my MAC and was setting my work environment from scratch. I have noticed that now I have a feature that I've never used before. When I press up arrow up a couple of times iterm basically chooses one of the previously used commands by itself and prompts the window with all the options I have used a specific command with. For instance I recently used ls with flags -lh -ls etc. I would like to get rid off this prompt as I cannot let's say press arrow up a couple of times to look for a different command I've previously used. Screenshot below for some clarification.
enter image description here

VSCode & PowerShell Extension & Azure - Parameter not auto filling options

So when I am in in VSCode using PowerShell extension the parameter options do not show up. For example if I type in "new-azresourcegroup -name test -location " the optional locations do not populate so I have to manually type them in. The odd thing is if I go to the VSCode PowerShell Console, this feature works as intended and I can tab though the "-location" options and choose which one I want. While doing this I am connected to Azure. The weird thing is that the console works, but the window where you write your code does not which to me is odd as its my understanding that the window uses the console in the background (if that makes sense). Not sure if this is a PowerShell extension issue or a VSCode issue. Any help much appreciated.
The answer = CTRL + SPACEBAR will reveal the options. Would be nice if if could be switched to the TAB key so that it would match the behavior of commandline or terminal.

Is drag-and-drop to open a file possible in VSCode?

I am wondering if something is wrong with my computer (or myself), because I can't seem to drag & drop a file into Visual Studio Code to open it in the editor. Closing an opened folder first doesn't make a difference. VSCode always shows me the 'stop sign', in every spot I tried (the editor, the opened tab bar, an existing opened file, ...).
Why does VSCode block this ?
(I have experienced this in earlier versions as well. Currently on v1.6 on Windows 7.)
Searching for a solution, I stumbled on this page, where one commenter explains:
I think you are running into the security issue where lower permission processes cannot send messages to higher permission processes. Explorere.exe, running at normal permission levels, cannot send the window message to winword.exe, running elevated.
I am indeed always running VSCode as Administrator, but not my Explorer windows.
When I run VSCode in non-administrator mode (so just my regular user), drag-and-drop works fine.
I feel silly as I lost 15 minutes looking into this. In case it helps:
Make sure you are not trying to open files from a zip file...
Cheers.

Vscode attach debug output window

I do not want Vscode to open up another window while debugging. Is there a way to attach this window inside the IDE?
If the above is impossible, is there a way to choose a more usable terminal? The default terminal doesn't allow for text selection which makes it unacceptable.
Since VSCode is not an IDE, we do not have a built-in terminal.
I tried the terminals on OS X, Linux, and Windows. They all allow me to select and copy text (however on Windows it is through the 'Edit' > 'Mark' mechanism).
Andre Weinand, Visual Studio Code
The vscode forums have a request for an integrated terminal with a number of upvotes, i'd advise adding your voice to the chorus.
It's a must to output the debug console writes to an attached panel in Visual Studio Code. Click an highlight a word in the debug output console text to do a global project search to find all code containing that string. A common thing like tagging error blocks with a unique ID that gets output to the console when the error happens. Full text search of the project source code tree for the ID...

How to create an Explorer window without Navigation Pane using Shell command Explore

My app Folders Popup is using the command ComObjCreate("Shell.Application").Explore(strPath) to create a new Explorer window. I need a way to tell this new instance of Explorer to comply with the Navigation Pane setting decided by the user (to show or not show the pane) in previous Explorer windows.
Actually, this setting is not taken into account by default in the new instance created by the Shell command and users of my app who prefer to use Explorer without this navigation pane are annoyed to see it reappear when my app is opening a new Explorer. Is there any solution to this (except sending keys to the Explorer, what I prefer to avoid)?
Simpler is sometimes better ;)
The Run command isn't just for executables, it can also open non-executable files like images/documents (as long as their file type is associated) and especially folders:
myFolderPath = C:\Path\To\Folder
Run, %myFolderPath%
Generally, it makes sense to use built-in commands or functions if available, before incorporating ActiveX, COM objects or DLL calls; those should provide extra functionality, and not replace what AHK can do out of the box. That, of course, occasionally requires some digging into the docs, but it's worth it! AHK is one of the most well-documented automation scripting languages for Windows.