Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource, specializing in consulting and engineering innovative, customized tools and IDEs, with a strong …
CDT Cloud Blueprint: Coding
June 19, 2023 | 4 min ReadAre you looking for a modern, web-based IDE for C/C++ development? Do you want to build a custom, domain-specific C/C++ IDE or tool? Then read on. In this article, we will demonstrate the language editing support for C/C++ in CDT Cloud Blueprint, including features such as auto-completion, code refactoring, and navigation.
CDT Cloud Blueprint is a vanilla tool for C/C++ development based on web technologies. You can download and install it. CDT Cloud Blueprint is not only a tool you can use, it also can serve as a basis to build your own custom C/C++ tools. In this article, we focus on the advanced code editing features in CDT Cloud Blueprint that helps users to efficiently write C/C++ code with powerful features such as auto completion and refactorings.
To support developers in editing C/C++ code, CDT Cloud Blueprint integrates the popular clangd language server. This component (clangd) provides most of the language smarts in the code editor. Clangd is one of the best options for C/C++ coding, compared to other alternatives, it receives very good feedback from the user community.
The feature set of language support in CDT Cloud Blueprint is too large to describe in one article, so let’s look at some examples on how well it supports the developer while coding.
Syntax Highlighting, Auto-Completion and Validation
The basics of language support are the capability of static syntax highlighting, dynamic auto-completion, and validation. As you can see in the screenshot below, CDT Cloud Blueprint highlights valid keywords (such as “#include”). Furthermore, it recognizes existing variables (such as “rect” in the example). When the user starts to type, CDT Cloud provides auto-completion based on the current context. Therefore, it does not only suggest a static list of possible keywords but also, for example, variables that are in scope. Additionally, it suggests functions to call on a specific variable (e.g. “set_values” in the example below). When selecting something from the list of auto-suggestions, CDT Cloud further guides the user. In the example below, you can quickly navigate through the function parameters using the tab key and fill in the corresponding values. Last but not least, the CDT Cloud editor, of course, shows errors and warnings: For example, it shows a warning in the example below if a variable is just referenced without actually doing anything.
Code Navigation
Another important aspect of language support is code navigation. CDT Cloud Blueprint allows you to easily navigate through the sources of a project. It is not only aware of files, but also of the rich language concepts, such as classes, functions and their relationship. As demonstrated in the screenshot below, you can for example jump to the declaration of a function, to its implementation and back to all callers, just with a simple mouse click.
Refactorings
As a third example of the language support in CDT Cloud Blueprint, let’s look at the refactoring support. Changing existing code can be cumbersome, especially due to references. As an example, renaming a function without any tool support can easily lead to missed references and therefore potential issues. CDT Cloud Blueprint can assist you with this. As shown in the screenshot below, simply right-click a function and select rename. Once a new name is entered, it will not only rename the function, but will also update all known implementations and callers. There are more refactorings available, just explore them via right-clicking elements in your code.
CDT Cloud Blueprint provides powerful, state-of-the-at coding support for C/C++ by integrating the flexible and popular language server clangd. Moreover, you can actually even customize the language support, e.g. to support a custom C variant or even a completely custom DSL. Remember that CDT Cloud Blueprint is not only a tool you can use, it also can serve as a basis to build your own custom C/C++ tools.
In the next post, we show how CDT Cloud Blueprint runs on the desktop, as well as online in the cloud and can be used just via a regular browser. Follow us on Twitter to get notified about future articles.
If you are interested in building a C/C++ tool or migrating an existing one to a modern technology stack, EclipseSource has many years of experience in developing custom C/C++ tools. We can assist you in the conception phase, and also the design and the development of your toolchain. Please have a look at our service offering for tools and web-based tools.