If you live your life in an editor writing code or configuration files, you need Visual Code in your life. Yes it is a Microsoft product and possibly surprising to use in environments that are not heavy on Microsoft or even using Windows operating system. But the truth is that it may well be the best thing to ever come out of Microsoft. If you read that as a diss of Microsoft, you do not appreciate how much I like Visual Code. 🙂
This however is not a love poem, it is a blog post of how one moves it or if your have not gotten inte Visual Code yet, how to get it set up with a reasonable starting point. This is written based on Oracle work, if you do not use Oracle there may be a thing or two you want to skip.
You are now ready to start editing files, but if you had it on another computer or you want to get a better configured version as your starting point, read on.
Before I continue, let me shout out to Morten Braten who’s blog post. I got started with a little over a year ago. It is still good reading to understand some of this and much of what I write about here has it’s base there. Some plugins there has since (in my mind) been replaced by others that does the same thing better.
.Net Core Runtime
For the Oracle Developer Tools extension you will need to have version 2.1 or 2.2 installed of .Net Core Runtime. Note that even though the extensions popup (if you start without it loaded) states 2.1 or later 3.0 does not work. This is the popup you’ll see if the extension is installed without this being installed the next time Visual Code is started.
I have had a situation where the extension had to be uninstalled and installed again when this happened.
Let us begin with installing extensions. You could search for each and install it one after another. It is a bit tedious so I really like that it can be done on the command line. I found this on SO for how to get a list of commands to install the same extensions. The following works on linux/osx, follow the link for windows.
code --list-extensions | xargs -L 1 echo code --install-extension
Grab the output and run on your new system, or use the following which is my set of extensions.
Next up is to update your settings.json file. It is located in $HOME/Library/Application\ Support/Code/User/settings.json. So grab it from your old environment and move to your new. Alternatively use this as your starting point.
Update that file in the same location with the contents. Make sure you keep anything that you want to remain.
One thing to point out is the setting code-runner.executorMapByFileExtension, it sets the code-runner extension to use a script on my machine to run SQL-queries. That script just maps between Visual Code and SQLcl. I’ll return to that in a later post or you could read Mortens post to see how he does it. After all I stole the idea/info from him.
This is a file that may not exist on your old system. I have just one and it is to emulate running SQL in SQL Developer where ctrl+enter is used to execute a query.
This should be placed in $HOME/Library/Application/Support/Code/User/settings.json.
You have now finished a setup of a good set of extensions and setting up some look and feel. From here just try out different things and see what you like. I good place to learn more is code.visualstudio.com. I may return to talk about certain things I like, like how small things in some of these extensions can improve productivity quite a bit, or a few other extensions I stumbled upon while looking up information as part of writing this post.