GNAT Studio 22 Release Notes ============================ We present here a few highlights of the new features in GNAT Studio 22. You can access the complete list `here `_. This GNAT Studio development cycle was focused on reducing the technical debt and improving the **Ada Language Server** by adding new features and stabilizing the existing ones. Two major internal components (Gtk+ and Python) were also updated. .. contents:: :local: Gtk 3.24+ Transition -------------------- GNAT Studio now uses Gtk 3.24+ instead of Gtk 3.14+, benefitting from various fixes and improvements made regarding styling, memory management, clipboard handling, along with new graphical features such as smooth scrolling. Python 3 -------- With the Python 2 End of Life Announced as January 1st 2020, we have actively worked to transition the Python interpreter embedded in GNAT Studio from Python 2.7 to Python 3.7. This included implementing new bindings between Ada and Python 3 (see *GNATCOLL.Bindings* and *GNATCOLL.Python* for more details), transitioning the existing plug-ins and the Python scripting API. For the end user, the transition should be transparent - with the important exception that any custom plug-ins will now be interpreted by Python 3. If you are developing your own GNAT Studio Python plug-ins, you can find more information about the transition, along with some helpful links to get started, in this section of the User's Guide: https://docs.adacore.com/live/wave/gps/html/gps_ug/GPS.html#transition-to-python-3 Completion ---------- GNAT Studio now uses a new engine for Ada completion, based on the LSP and the **Ada Language Server**. This fixes issues when completing some Ada 2012 features such as "for of" loops or very complex tagged type hierarchies. This also makes GNAT Studio start up faster, avoiding the *load constructs* task that parses all the files to provide completion. This will also allow us to fix issues more easily, since this engine is fully based on **Libadalang** and thus will benefit from all the fixes made on that technology. .. image:: images/for_of_completion.png :width: 400pt This provides enhancement to startup time and memory consumption, as the indexing phase is now shared between all features in the Language Server. With this new engine, you can have snippets-based completion by enabling the :menuselection:`LSP --> Completion --> Use snippets` preference. When enabled, snippets will be inserted for some completion items (subprograms, aggregates...), allowing you to fill the needed parameters/fields one by one using the TAB key. Note that users can revert to the old engine by disabling the *GPS.LSP.COMPLETION* trace in your :file:`$HOME/.gnatstudio/traces.cfg` file. .. image:: images/snippet.png :width: 400pt In addition, we have added a fuzzy mode for completion, which is enabled by default and controlled by the :menuselection:`Editor --> Completion filter mode` preference. .. image:: images/fuzzy.png :width: 400pt Users can also choose whether they want to insert or replace the current word when completing via the :menuselection:`Editor --> Completion insert mode` preference. Refactorings ------------ New refactorings have been implemented in the **Ada Language Server** and are thus available in GNAT Studio. These new refactorings include: * Import missing package * Remove parameter * Change parameter mode * Safe rename * Identifier collision (including collision with other compilation units, subprogram parameters, and subtype indication of a subprogram parameter) * Identifier shadowing (both when an identifier hides or is hidden by another) * Subprogram overriding that changes the dynamic dispatching * File rename when renaming a top-level declaration (following GNAT convention for now) * Suppress separates All these refactorings are available depending on the context by clicking on the light-bulb icon that appears on the editor's left side. .. image:: images/refactorings.png :width: 400pt Doing *undo* (via a key-shortcut or the toolbar icon) after a refactoring will revert all the modifications made for this refactoring. This is useful to revert a *rename* that affects several buffers at once for instance. C & C++ Support --------------- Several formatting preferences have been added to the :menuselection:`Preferences --> Editor --> C & C++` page. Extra tuning can be done in the :file:`.clangd-format` file which GNAT Studio creates for each C/C++ project in the top source directory (see https://www.clangpowertools.com/blog/getting-started-with-clang-format-style-options.html for more information about formatting options). Navigation ---------- A new *lock or unlock current editor* action has been added, allowing users to lock a given editor at a given position. Locked editors are still navigable manually, but are insensitive to all *jump to code* events, such as clicks in the :guilabel:`Locations` view, navigation actions (*find all references*, *goto declaration*, etc.), clicks on the :guilabel:`Call Trees` view, in the :guilabel:`Call Stack` view, etc. Contextual menus to lock or unlock a given editor are accessible by right-clicking on the editor tabs. .. image:: images/locked_editor.png :width: 400pt Notebook tabs are now reorderable using drag-n-drop within the same notebook. This is available due to the transition to Gtk 3.24+. .. image:: images/tab_reordering.png :width: 400pt Ctrl-clicking or executing navigation requests on mixed-case entities mentioned in comments now works if this entity is referenced in the current file: for instance, ctrl-clicking on an entity mentioned in comments will jump to its declaration. Source Editor ------------- The tooltips that appear when hovering over entities are now clickable and selectable, allowing users to copy their contents. To copy text from it, just click on the tooltip: the tooltip will then be highlighted and its contents will be selectable. .. image:: images/selectable_tooltip.png :width: 400pt The auto-highlighting that occurs when the cursor is placed on a given word has been reimplemented via the LSP *textDocument/documentHighlight* request. As a result, the :file:`auto_highlight_occurrence.py` plugin has been removed. The *write* and *read* references are now highlighted using a separate color. It's also more stable and faster than before, especially on large files.