VSCode Tips & Tricks - Importing Servers' Details from the Windows Registry
Need to connect your VSCode to an InterSystems Server?
Heard of this option?
With more and more people starting to use VSCode as the IDE for our products I thought it might be beneficial to provide some small tips and tricks along the way to help people getting started and getting more productive. Therefore I'm starting this series of small articles.
A few important clarifications:
1. These are not intended as a tutorial or a formal learning resource - if you're looking for one of those - please check out this excellent online exercise for example, or review this great session from our last Virtual Summit.
2. These "Tips & Tricks" are not my inventions - they typically are already documented or mentioned in someplace already, I just wanted to put them together and perhaps provide some more guidance or examples. I'll try to refer to the source where relevant.
3. Though I've already jotted down some ideas and topics I want to cover in this "series" I don't know how fast I'll be able to roll them out, so I can't commit to any frequency they are going to appear...
Here goes the first -
One of the first things you'll need to do in VSCode is define your Server connections. You can do this manually within the JSON Settings file of the InterSystems Server Manger extension, or by pressing the (+) sign while trying to connect to a server (and answering the prompts), but if you're on Windows, you can simply import your server definitions from the Windows Registry.
This is in fact documented as part of the extension's documentation (in the extension's VSCode Marketplace page, in the GitHub Repository Readme, and as displayed in the extension's Details page within VSCode itself - really all the same text...) -
When you install an instance on a Windows machine, or define servers for a client via the Server Manger tool, the Windows Registry gets updated.
For example I had a customer with 9 different servers defined which they might want to connect to (Prod / Dev / Test environments, LAN vs. DMZ, etc.), another customer has even more (much more). Doing this one by one in VSCode could be tedious (and prone to human error).
Let's assume I have for example this situation on my machine, as defined in the InterSystems Server Manager -
I can use the "Import Servers From Registry" option of the InterSystems Server Manager extension.
Simply open the Command Palette (View -> Command Palette... or Ctrl+Shift+P) start typing after the > character "InterSystems" and you should see this option -
[Or see another option in the comment below]
Then you will be prompted for a Username to connect to one of the servers (you don't have to enter one if you don't want it to be saved but rather prompted every time you connect), then for a Password, then whether to store the password for all other servers as well (you'd don't have to store the password at all if you don't want to) and then all the server definitions will be added.
For example per the Server Manager image from above (and assuming I provided a Username of SuperUser) this is what the Settings JSON will look like after the import -
Here's a short GIF demonstrating this quick process (it's starts off by just having the 3 default server connections defined, and ends with the additional 5 servers per the example above):