A powerful IDE for Gnome

The Right Stuff

© Lead Image © Corina Rosu, 123rf.com

© Lead Image © Corina Rosu, 123rf.com

Article from Issue 231/2020
Author(s):

This integrated development environment for Gnome offers several features gedit lacks.

Have you ever tried to knock a nail into a wall with a screwdriver or drill a hole with a saw? Of course not: You know to use the right tool. Then why would you use Gnome's gedit as your integrated development environment (IDE)?

When it comes to global searching, Git integration, and an integrated terminal, Gnome Builder is the right tool for programming in a Gnome environment. Gnome Builder emerged from a crowdfunding campaign [1] in 2015, but many developers still don't have it in their toolbox. Gnome Builder 3.34, released with Gnome 3.34, deserves its turn in the spotlight [2].

You can launch Gnome Builder directly from the application menu (see the "Installation" box); it starts up with a wizard that opens the last project you used or clones known Gnome applications like calendars, files, or photos (Figure 1). Alternatively you can start a new project by clicking on Start New Project… or clone any other project on the computer by selecting Clone Repository…. After importing, the system automatically offers to download the software development kits (SDKs) required to build your project.

Figure 1: A wizard helps you create your first project. Code from existing projects can be cloned directly to your own computer using Builder.

Installation

Every distribution maintained by Gnome in its package sources should also contain Gnome Builder. The installation for Debian, Ubuntu, or Linux Mint is handled directly with the graphical package manager or via:

sudo apt install gnome-builder

On Fedora, use:

sudo dnf install gnome-builder

Arch Linux also includes Gnome Builder in its package sources.

However, the major distributions tend to lag behind when it comes to the Gnome Builder version. An update to the current version 3.34 is only available if you update the distribution, too. Ubuntu, for example, delivers Gnome 3.34 with Ubuntu 19.10 "Eoan Ermine." However, at the time of writing this article, Gnome Builder 3.32 is the current version found in Eoan Ermine's package sources.

Optionally, you can install Gnome Builder 3.34 independent of your distribution choice using a Flatpak, which you can pick up from Flathub [3]. On a test system with Ubuntu 19.04, the installation worked in this constellation without any complications. However, you need to prepare the system for installing Flatpaks following the instructions from the Flatpak website [4].

Operation

In the sidebar to the left of the main window under Project Tree, you will find Version Control, Build Targets, Unit Tests, and Files. If you double-click on one of the source code files, Builder opens its contents as a page in the main window to the right (Figure 2). Pages are files opened in parallel by Builder. All of the currently active pages appear above the address tree under Open Pages. By clicking on one of the entries, using the left and right arrows next to the file name in the editor area, or pressing Alt+Ctrl+Page-Up/Page-Down, you can quickly toggle between the pages.

Figure 2: Builder 3.34 with one file opened. The sidebar containing the project tree can be hidden if necessary.

You can use the toolbar buttons top right to switch between Editor and Profiler mode (more on this later) or select Build Preferences, which takes you to a menu where you can create new files or open additional windows and terminals. The next two buttons to the right open and close the sidebar and footer. For example, Builder can output the build log in the lower area of the application window or display an integrated terminal window.

In the middle of the toolbar, Builder displays a field with the name of the current project; clicking on this field displays the project's details. Clicking on the brick wall icon lets you build the current project; clicking on the Play button next to it executes the project. Gnome Builder reports any errors or problems in the build output in the footer. The search field at the right edge of the toolbar not only searches in the currently active source code file, but also automatically returns matches from all of the project files. In the hamburger menu, you can start new projects or open the Preferences.

Gnome Builder covers an IDE's most important functions. Builder becomes really interesting when you start to customize the workspace. Take a look at the bar at the top of the editor area, for example. Next to the arrows for toggling the page, you will find the name of the opened file, a jump function that automatically sends the cursor to a selected function, and the line number currently being edited. Below the icon with the down arrow, you'll find a menu for configuring the workspace.

Flexible User Interface

The Open in New Frame option splits the workspace vertically into two (or more) sections. In the default setting, Builder displays the contents of the currently open page (that is, the file currently being edited) in parallel. Changes in one section automatically appear in the other. In addition, the Split option can be used to split the currently active frame horizontally (Figure 3).

Figure 3: Several files can be displayed in the workspace in the form of frames. If required, Builder also lets you subdivide frames into several areas and thus edit different locations in a file simultaneously.

Gnome Builder supports simultaneous editing of code or text at multiple locations in the currently opened file. Simply left-click on the desired positions while holding down Ctrl. Everything you then type will appear at the selected locations.

All the windows always display the same content. This means that you can make changes to several parts of a program file in parallel without having to scroll through the window. If you work with multiple monitors, you can use the Open in New Workspace option to open another code window and move it onto the second screen.

To help optimize your program's performance or find errors, Builder integrates Sysprof, a system-wide profiler for Linux [5]. To do this, instead of starting your program directly via the Play button, use the drop-down menu next to the button and select the Run with Profiler option.

When you do this, Builder requests administrative rights and then logs the system's activities until you either close the application or click Stop Recording in the Builder editor area. The program then automatically opens the recording, from which you can then read the CPU history, the generated network traffic, or stack traces and counters over time (Figure 4).

Figure 4: Gnome Builder directly integrates Sysprof, which helps programmers find bottlenecks and memory hogs in the program code.

Editing Text

You don't have to be a Gnome developer to use Builder. For people who want to work on plain old text or Markdown files, the program includes a powerful search function, as well as an integrated spellchecker. You can start searching by pressing Ctrl+F. Pressing the button next to the up and down arrows expands the search dialog and gives you a Replace option. The button on the far right adds options for regular expressions, uppercase and lowercase, and restricting the search to whole words. Pressing the Esc button closes the dialog again.

The spellchecker can be accessed by clicking in the text and selecting the spellchecker option in the context menu. As is usual with other text editors, Builder will immediately highlight misspelled words or expressions that are not in the dictionary with a red underscore. It also displays a sidebar on the right side of the screen, where you can go through the text word by word. You can correct or ignore each unknown word individually, with Builder usually providing helpful suggestions (Figure 5).

Figure 5: Not just for programmers: Builder functions as an editor for simple text files or Markdown documents (e.g., this article was originally written in Builder).

Optionally, you can select Highlighting | Spellchecking in the context menu of the editor window to easily highlight spelling mistakes.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Workspace: Business Data

    Learn how to analyze your business data with the help of OpenOffice.org Base and the Sun Report Builder extension.

  • Jam.py

    Create a convenient interface to your database with Jam.py.

  • First Android Builder Summit Announced

    The Android Builder Summit, to be announced by the Linux Foundation on Wednesday, February 16, will bring together OEMs, device makers, systems builders and kernel community to collaborate on the Android platform.

  • Workspace

    Dmitri shows how to create an OpenOffice.org extension from scratch and introduces a useful extension packaging tool.

  • Gnome 46 Alpha Available for Public Testing

    The development team behind Gnome has released the latest alpha build for testing and it offers some pretty cool new additions.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News