• VSCode

    Display file theme icons in a VSCode TreeView

    I am working on a new extension for VSCode that uses a Virtual File System and displays a folder and files tree using the TreeView API. A TreeItem object represents a file or a folder and it can be customized to better represent the object it represents: folder for example can be expanded to show their content through collapsibleState, or a command to execute when the item is clicked in the TreeView (for example this allows to open a file in a new editor). It is also possible to customize a TreeItem appearance with an icon, very useful to visually identify item types: Here comes the lesson learned. Since my extensions deals with files and folders, I wanted them to respect the user’s theme so I set iconPath to the appropriate value from ThemeIcon Anyway, running the extension, presented me with this: All the TreeItem instances respect their assigned type (file or folder) but they are definitely not using my icons theme. It took me some back and forth before I noticed this in the TreeItem documentation: resourceUri The URI of the resource representing this item. Will be used to derive the label, when it is not provided. Will be…

  • VSCode

    What do you do for fun? A Visual Studio Code extension

    The pandemic has come and gone (?), as most working for tech companies I worked exclusively from home for over two years and even if our offices have been technically open for about three months, I and most of my colleagues are still working from home at least a couple of days a week (and some, hired during the pandemic, have not even seen our offices yet). At the height of the pandemic, during summer of 2020 (before vaccines where available, most public places closed or with entrance restrictions, masks mandates for indoor activities… I’m sure you remember) I had a bit of free time in my hands and decided to learn something that could hopefully also be useful. I have been using Visual Studio Code since the very first release and always been curios about how to write and extension. I had already created a simple color theme (Hogwarts colors for VSCode) but this time I also wanted a relatively simple project to learn Typescript; I thought an extension to help working with text (conversions, manipulations, sorting, that kind of things) could be useful for working with log files and parsing command line output (I use those a lot).…

  • VSCode

    Microsoft authentication provider is not available (VSCode settings sync) – AADSTS700003

    I have been using settings sync in Visual Studio Code since it was first released in the Insiders build and it has been working well for me, I currently sync settings from Insiders and Stable releases on four different Windows machines and one MacBook Pro. Then, all of a sudden the Insiders instance on one of the Windows computers stopped syncing; Weirdly enough, the Stable build on the same machine kept happily working and syncing settings, suggesting the problem was specific to this Insiders installation and not some machine wide problem. It’s worth pointing out again installation, it was not even a problem with the general Insiders build since the same build was still working fine on all other machines. At first I tried to start VSCode without extensions (code-insiders --disable-extensions), then I tried to fully remove VSCode (and manually deleted all relevant folders under my local profile), restarted Windows… the usual deal, all with no luck. I then decided to open an issue on GitHub (more on that later) while I continued my investigation; the first comment from RMacfarlane suggested something might have changed with the network configuration on the machine, but again, that should have affected the Stable…

  • .NET Core,  Powershell,  VSCode

    Test Powershell on Linux with Visual Studio Code and Docker

    One of the promises (maybe, the biggest promise) of .NET Core and Powershell Core is being cross-platform, be able to develop applications (or Powershell scripts and modules) that can be executed on Windows, Linux and macOS; but how can we be sure the our application or script/module will actually run properly across all those platforms and distros? Talking about Powershell, PSScriptAnalyzer helps to check a script or function compatibility with certain Powershell versions or different platforms. But what if I want to actually write and test my script/module on Linux (assuming my main machine is Windows, of course 😉)? One easy solution is to spin up a virtual machine, install the tools I need (.NET Core, Powershell Core, Visual Studio Code and anything else required) or use the Remote Development extension pack for Visual Studio Code and use Docker containers instead. Note: this requires Visual Studio Code Insiders at this time; pay attention to the Installation notes for good tips to get started. Also, take a look at Developing Inside a Container in the official VSCode documentation. The extension pack allows to choose between Windows Substrate for Linux, connect to a remote machine through SSH or run a Docker container…

  • .NET Core,  dotNet,  Powershell,  VSCode

    Powershell Core binary module with Visual Studio Code

    I wrote countless scripts and a good amount of modules (and functions) in my years as Service Engineer but all of them are script modules, I never really created binary modules. The main reason is that I like to write in Powershell but I also like the fact that, not being a compiled language, it is very easy to share and modify the source code for a script module and it is immediately ready to be reloaded and used. Anyway out of curiosity and to learn a different approach to building modules, I decided to try to convert one of mine from script to binary; my first step was (of course) a quick search to find some samples and getting started articles and I found a few good ones (referenced below) but all of them use Visual Studio and the full version of the .NET Framework, while I want to use Visual Studio Code and .NET Core. So here’s what I came up with. First off of course I need .NET Core (I am using the latest .NET Core 3 preview 8 at the moment), Visual Studio Code and the C# Extension. Next, I’m going to create a Class Library…

  • Tools,  VSCode

    Hogwarts colors for VSCode

    Developers spend so much time in their IDE of choice that it has to feel like a second home: it is not uncommon for devs to spend time to customize, often in minute details, the look and feel of their code editor to maximize their productivity. My favorite editor by far is Visual Studio Code, the Marketplace has a growing number of extensions and Color Themes are a popular category, there are plenty of themes, colors, icons to choose from. But despite all this abundance I could not find a theme that reminded me of my other favorite environment (and book series): Harry Potter and Hogwarts 🤓 So I decided to create my own, trying to stay as close as possible to the colors seen in the movie series and described by J.K.Rowling on Pottermore: Colours Red, green and shocking pink: the importance of wizarding world colours How do you colour coordinate the wizarding world? Colours or Pottermore damngoodshindig.com for the Hogwarts and House crests On the technical side, creating a color theme for VSCode is not complicated, the documentation has what’s needed to get started and follow along some samples: Theming (under extensibility reference) Color Theme Theme color reference Maybe…