• 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).…