José Luis Sánchez
Dec 1, 2018 · 4 min read

Inside the toolbox of every programmer, the code editor occupies a prominent place. It’s one of the programs you spend most time working with, so it’s very important to feel comfortable working with it and you should also know it well enough to be productive using it.

In this post I am going to introduce the editor that slowly has become my favorite editor, I will explain the reasons why I use it and the extensions that I use, of course oriented to its use with Harbour. I recognize that my interest in Visual Studio Code — VSCode from now on — was to use the dark themes that it has, merely aesthetic reasons, but the functionalities that it incorporates have turned it into my favorite editor. There are things I still don’t know well, such as creating tasks, but I’m still trying to learn how to use them.

Before going on, I’d like to do a digression. If you make desktop software you should try to make your application look cool and beautiful, and for that you should know the currently cool applications. If you use the Norton Commander and an editor from 20 years ago, you don’t know what the current applications look like, so it seems normal to use buttons with 3D effect and those things that Windows XP had. My recommendation is that you use a modern editor and VSCode is one of the most beautiful available out there.

When talking about using VSCode and its use with Harbour the first thing to say is that you must install Antonino Perricone’s extension for Harbour — aperricone.barbour onwards — which you have available at https://marketplace.visualstudio.com/items?itemName=aperricone.harbour. This extension add a lot of features to use the editor with Harbour as you will see below.

A typical aspect of VSCode working with a Harbour project is the following, in which you can see 3 distinct areas: (1) the explorer area, (2) the code window, (3) the mini-map and (4) the status bar that shows that the file I’m editing is using the Harbour extension. The mini-map is something that attracts attention at first sight, but I don’t find it any use.

VSCode with Antonino Perricone’s Harbour extension

Inside the explorer (1) we have the list of open editors, the project folder we are using and the outline view. The outline view is a feature added by the aperricone.harbour extension and is a tree list with the functions or methods of the .prg file that we are editing and the variables we have defined in it. This outline greatly facilitates navigation in large code files.

The code window is where we edit our code and we have all the usual features, but I want to draw attention to two things that I find very interesting: (1) the first is the possibility of dividing the editing area vertically to show at the same time different or the same source file, and (2) the help offered by aperricone.harbour on the Harbour functions as we write them.

VSCode with 2 editing areas and the Harbour intellisense

One of the things I like about VSCode is the possibility it has to add extra functionality, and there is a lot of information about it. For example, I often use the feature of changing a word to uppercase, and VSCode does not bring this feaure as native. Searching a bit on the internet I soon found a way to do it. Go to File > Preferences > Keyboard shortcuts and you have to edit the file keybindings.json by entering the following:

Shortcuts definitions for uppercase and lowercase

To compile and run your application you must define tasks. I just use two task, one to build my application and other to run it, and I’ve defined it as following:

Tasks for compile and run an application

With this I have enough to compile and run my application, but I think it’s a really minimal use of what can be done. I know that with the extension aperricone.harbour you can debug the application from inside the editor, but I don’t know how to do it. I hope Antonino will find time to do a tutorial about it.

In addition to the extension aperricone.harbour I use the following extensions for VSCode:

I hope that after reading this article you give a try to VSCode with Harbour, and if you already use it and want to share some trick about it I hope you do in the comments.

Harbour Magazine

Publication about Harbour programming language

José Luis Sánchez

Written by

Desarrollo software personal que comparto en alanit.com

Harbour Magazine

Publication about Harbour programming language

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade