Tag Archives: Visual Studio Code

Bye-Yee ISE – Hey Yo VS Code

It is official — as official as it is going to get anyway — but I am in the final six-month stretch of my eight-year consecutive run of writing about PowerShell. Not that I will be done after eight years, but I have been at this awhile. What is also official is that I have written the dumbest post title yet. I am going to go with it though.

Today I had an interesting “conversation” on a post in the PowerShell Subreddit. The full link, if you are interested, is included at the bottom of this post. But really, the important parts are all included here.

The post was about someone using Write-Host that should have been using Write-Output. That was not where I took the conversation, however. Instead, it became a discussion about moving away from the ISE to Visual Studio Code. I think that this is an important move, and so I thought I would include it all here because I think I made some good points, and maybe because I am after that 416 post count by June 2022. More the first, though.


Me: “Beyond that, OP, it is time to move away from the ISE, and probably Widows PowerShell too. 2¢


Not me, or the OP: “Nah, ISE4LYFE

Me: “[SMH] Think of your résumé: ISE vs. VS Code. Speaking of your résumé, did you do create that in Notepad and print it on a dot matrix? 😉 I loved the ISE once too, but I think it’s time…


Not me, or the OP: “I mean, I’m not old enough to have used dot matrix (well, kinda, 30)

My main issue with VSCode vs ISE is that it’s a UI mess from as soon as you install/open. Vs ISE, it’s just notepad ontop of powershell.

ISE is just easier for me for the quick and simple stuff, where i just bust out some script for a minute or two.

Granted, running the code-server is really nice


Me: “Oh, I get it. VS Code takes some time. It took me some to finally give up the ISE in full. And, I’m the same guy that paid attention to the PowerShell launch in 2006. One person, around that time (that I believe was associated with Microsoft), said that if you’re using VBScript, then continue to use it. That it is still going to be there, as in, in the operating system. That’s all it took for me to not pay attention to PowerShell! I bet the ISE is still going to be there too.

Cut to six years later, in 2012, and I finally let go of VBScript, which I loved, and forced myself to use PowerShell, which I now love. You’d have to pay me a large amount of money to even look at VBScript now. While I can’t say the same thing about the ISE, I’d miss VS Code an awful lot if the ISE is all I had. While it took some time and frustration and wanting to go back, I pushed on!

Speaking of, “if the ISE is all I had,” I recently wrote an AWS CloudFormation template to build out a vanilla Windows Server, server. It was beyond frustrating to build a new instance and only have the ISE. As a part of the CloudFormation, I installed PowerShell 7, installed VS Code, and installed the PowerShell VS Code extension. Again, I once loved the ISE.

Here is the PowerShell Subreddit post.

Add the ISE’s Ctrl + M to Visual Studio Code

As suspected, by me at least, the more I use Microsoft Visual Studio Code, the more I’m going to want to modify it. Remember, I just came into the light with the recent addition of Region support in version 1.17. This desire to modify is no more true than seen in an edit I made today to the keybindings.json file. This file allows one to override the default keyboard shortcuts in order to implement “advanced customizations.” It’s pretty awesome, and well appreciated.

Today I added the section for the Ctrl + M keyboard combination, such as can be seen in the last, or third, section of the below JSON. What’s this do, right? If we think back to the ISE (Microsoft’s Integrated Scripting Environment) you may remember that Ctrl + M collapsed all collapsible sections in the current script, or function. With this change in Visual Studio Code, I can now continue to use Ctrl + M to quickly collapse all the sections in my active function, or script. This is until I realize what the default action of Ctrl + M — Toggle Tab Key Moves Focus — actually does, and I find it necessary. I do want to mention, that I could’ve just went with the new keyboard combination of Ctrl + K Ctrl + 0. Ugh, no thanks for now.

[
    { "key": "ctrl+`",      "command": "workbench.action.terminal.focus",
                               "when": "!terminalFocus"},
    { "key": "ctrl+`",      "command": "workbench.action.focusActiveEditorGroup",
                               "when": "terminalFocus"},
    { "key": "ctrl+m",      "command": "editor.foldAll",
                               "when": "editorTextFocus"} 
]

While we’re here, I might as well mention (a.k.a. help myself remember), what the first two sections in my keybindings.json file do, as well. These allow me to use Ctrl + ` to switch focus between the editor on top, where I write my code, and the terminal below, where I can run PowerShell commands interactively. While that’s all for this post, I won’t be surprised if I’m back here updating it with new additions I make to my keybindings.json file.

As a newbie to Visual Studio Code for PowerShell development, I already don’t like even seeing the ISE. It’s pretty amazing what Region support in Visual Studio Code did to me.

Visual Studio Code Regions

It’s happened.

Microsoft has figured out how to get regions to work in Visual Studio Code. I thought it, and I may have even said it too, but it’s been my holdout for not using Microsoft’s code editor for PowerShell. While I’ve been using Visual Studio Code for my AWS YAML creation without regions, I hadn’t been ready to give up the ISE (Integrated Scripting Environment). Well, as of today, those days are over.

So what’s a region, right? It’s an easy way to collapse a section of code that isn’t collapsible by default. I greatly suspect I first learned about them from Ed Wilson — the original scripting guy. Here’s a couple examples from my old friend, the ISE. In the first example you can see the region sections aren’t collapsed and therefore display the commands. In the second image, you can’t see the commands at all. This becomes quite helpful when the region is loaded full with code and commands that simply don’t always need to be seen.

Here’s the same examples in Visual Studio Code.

What a glorious day! After being all set to use the ISE for the upcoming Arizona PowerShell Saturday event (2017), due to a lack of region support in VS Code, I’m glad to report that I’m going to go ahead and use it for my session. I didn’t see that one coming!

Finally, here’s an example of nested regions. I often do this as well, and these seem to work as expected.