Rechercher

Tips #3.1 Development : Code Editor - Colorization

Mis à jour : 8 août 2019




Before, I was mainly developing JavaScript. What I hated most about doing JavaScript was configuring my text editor so it would force me to have a correctly indented and colorized code and to provide me with a correct autocompletion.


I was mainly using the Sublime and Atom text editors. What a hell to configure and especially to keep up to date the dozens of plugins we work with!

So when I started coding in 4D, it was a pure pleasure to find an editor who knows how to indent, colorize, with an autocompletion that works like a charm and all this without any need to configure anything. Well almost... because we will see in a series of tips the few tricks that can make your development more pleasant and efficient.

I will of course show you mainly what I use. Feel free to comment, what you use as options and why you like to use them.


Colorization

By default, I find that the colors are well suited for the different types of elements. My first modifications concerned the color of process variables. I find that the basic blue color is too close to local variables and does not allow to quickly differentiate a process variable from a local variable. I decided to use the orange color because it is not used for any other type of element.

The second modification is for the attributes of an object and the "member function", I chose a light blue for the attributes. This helps me to understand that an attribute contains something because the main containers are local variables which are blue. For the "member functions" I first wanted to put them in green color as for the 4D commands, but then I had the thought that a "member function" can be a method provided by 4D (query, orderBy, etc.) as well as a project method that we would have assigned to an attribute of our object using the "New Formula" command. So I decided to put the same color as a project method.... But it still didn't work because a "member function" can be either one or the other. So I decided to take the round color palette, and put my cursor between the 2 colors. I came across a pretty colour between blue and green that suits me perfectly to express the ambiguity of what a "member function" can represent. I also put some bold to accentuate the difference between the "member function" and the rest of the line.

This is what my code looks like with these settings:


Difference between a local variable and a process variable
Colors of an attribute and a "member function

Colors of 4D commands, member functions and project methods.

Well, since it's getting late, we'll see what happens on the next episode.

39 vues

Posts récents

Voir tout

Me contacter

  • Twitter
  • YouTube

Biel/Bienne - Bern - Switzerland