Visual Studio Code Setup for Redis

Harkrishn Patro
2 min readJul 12, 2021
VS Code meets Redis

Recently, I have been working on Redis OSS and I sometimes write the code on my personal system (Macbook Air 13" 2017) which is sufficient enough to develop systems code. I’ve been using IntelliJ since my internship days and I’m big fan of Jetbrains product. However, IntelliJ Ultimate/CLion comes with a big price tag (649€ for the first year) if you’re developing software on your own. So, I wanted to try something which is free and still convenient to use. So, I tried setting up VS Code which is also open source editor by Microsoft. And I was blown away by the ease and maturity of extensions for VS Code. I would like to share my setup below. There are three key areas I’m going to cover, Extensions, Tasks and Launch.

Extensions (with links):

Tasks

In the tasks.json file, you could setup instructions to run certain task like building, testing, packaging, etc.

I’ve three tasks for now.

  • Clean — make clean
  • Compile — make noopt
  • Build — Clean & Compile (You can create a lineage of tasks. Ammazing!)
  • writeRedisPID — Grep forredis-server and put the process id to a temporary file. (Will see below the purpose of this.)
VS Code Tasks

Launch

In the launch.json file, you can define how to run/debug your application. I’ve two different configurations.

  1. Run — . In this case, it’s Redis, so after compiling we get theredis-serverinside the src directory. We can also define the preLaunchTask, which we already discussed above. And I’ve provided Build as my preLaunchTask. So, the redis gets compiled and then the process gets started.
  2. Attach — This is handy to attach to an existing running process and debug it. Generally I work on a single Redis process and here I use the preLaunchTask writeRedisPID to store the running redis process id in the temporary file and provide that as input in the launch configuration "processId":"${input:redisPID}
VS Code Launch Target(s)

You can also copy the below content and use it directly if you’re also working on redis or change the program field according to your application.

I hope this will be helpful for people who would like to start with systems programming and want a simple and easy setup. I’ve also shared some of my learnings. Feel free to check them out.

Let me know in the comments if you are using any other plugins/extensions for better productivity.

Have a good day. Ciao!

--

--