This year was yet another productive year for Comma, the Raku programming language IDE. Our small team has worked on numerous small improvements and bug fixes, as well as bigger features. In this article we’ll take a look at some bigger things that has landed this year.
Let’s take a look at this case to start with some code-y example. Copy-paste mistakes resulting in re-declarations are common in cases where a lot of similar code needs to be produced, and the Rakudo compiler is usually very helpful at detecting duplicate classes or subroutines.
Here we have two files, Library.pm6 and Project.rakumod. One declares a subroutine available for importing and a couple of classes. The second one has quite a lot going on, so let’s go step by step.
First, we have an import line for the
Test::Library compilation unit. Comma will auto-complete names from the project as well as from the ecosystem for you.
Next, we have a re-declaration of a class from the outer file, Comma also notes where the class from an external source was first declared. The symbols are also not leaking between the files.
Next, we have a subroutine
triples declared with an argument and its usage. It also contains a lexical subroutine inside.
Next, we have the subroutine re-declaration and not a re-declaration of its inner lexical
oyako. Of course, when we have
multi subroutines, we can have them without errors.
Note how some subroutine names are greyed out, that’s because they are declared, but not used – another heuristic, working also for private attributes, private methods, parameters and lexical variables.
Last, but not the least: colour highlight on the left side of the code editor and in the project files viewer describes current state of the files in the VCS.
Pod documentation preview
Nobody likes documenting the code, right? Sure thing, nobody except those who do.
At least in Comma you have more meaning to do it: as it renders your documentation, for you and for your users.
In the preview tab on the right of the editor we see rendered HTML generated from the Pod in the editor. Generated documentation is for things that are visible externally, such as packages (classes are packages) or exported subroutines. Items are divided into categories
Subroutines. For a Raku entity which can carry documentation, the documentation lines are merged into a single description.
For a subroutine, parameters and its return type are considered, such as things like if the parameter is optional and its type.
For packages, such as a class, methods and attributes are considered. Comma understands traits like
is rw or how private methods should not be documented.
As a side note, Comma understands when things in a string are interpolated, such as just variables or calls, indicating it with highlighting, thus preventing silly mistakes of trying to interpolate with just
As yet another side note, note highlighting in the
!invisible method: integer literals are marked, indicating they were detected as “useless use” by Comma.
And last, but not the least: if you run Comma with
raku-doc option and a path to a Raku distribution, it will analyse the files and create the same structure of directories containing HTML files with API of the distribution documented.
Raku migration tool
More than a year has passed since Perl 6 was renamed to Raku, and there are still a lot of old extensions in the distributions around. To help with the migration Comma provides a tool to detect outdated files in the project, allow to select which ones you want to update and auto-magically apply changes.
The heuristic is activated on the project opening, but only sure Perl 6 extensions are detected (as it can be a mixed Raku+Perl project, so it won’t be nice to rename
.pm files). Invoking the tool from the
Tools menu allows to update all possible extensions.
Worth to note how updating also updates the
META6.json file for you, so updating a project can take a couple of clicks.
Those are just some of the major features landed this year I picked, they are of importance as they touch three topics related to writing software: the code, its documentation and the project organization itself, all in a single place!
The latest public builds of Comma can be found at https://commaide.com/download.
Write software, debug, do not push yourself too hard – and happy holidays!