Day 3 – Atom Editor support

If there is one thing in abundance in the world of programming, it’s text editors. It seems like at least once a month a new one will be trending on HN or Reddit.  While many are often just pet projects or slow to add features, Github’s Atom Editor has rapidly gained a strong feature-set and has risen far above the pack and now competes with Vim, Emacs, and especially Sublime Text. Though many see Atom as a text editor for web developers, it actually has packages available for pretty much any language (the Atom team has even built a program to convert TextMate packages to Atom packages, which made it easy to seed their ecosystem).

Atom’s Perl 6 support

Out-of-the-box, Atom supports Perl 6 via the language-perl package included with the base install.  However, the highlighter has many shortcomings and doesn’t illustrate (pun intended) the breadth of features that Perl 6 provides. So I endeavored to write a syntax highlighter that would be much more vibrant and let the language truly shine! And here is a glimpse of language-perl6fe:

Screenshot from 2015-12-01 14-33-49

UI: One Dark, Syntax: Railscast, Font: Fira Code

Because Perl 6 support is builtin, you will need to use a workaround shown here to use my custom syntax highlighter. Once you’ve gotten that taken care of, you’ll have a highlighter that provides an abundant assortment of highlighting which the builtin package doesn’t provide.  Things like numbers, all the new regex features, grammars, every kind of operator, complete pod support and so much more!

Useful Packages

If you are interested in transitioning from Vim to Atom, there is the lovely vim-mode package that will get you all of the great text-manipulation shortcuts and the various modes that Vim provides.  A few packages that I’m also using in that screenshot are tool-bar (provides the toolbar), flex-tool-bar (allows you to configure your toolbar via a json file), minimap, and git-plus (though you can’t see it).

The linter (stats shown on the lower left of the status line) used to need installing but is now provided builtin and you can install various linters that hook into its functionality.  I’m in the midst of working on linter-perl6 which will provide support for the linter via perl6 -setting=RESTRICTED -c.  I have many errors covered and a generic one that catches most of those I don’t explicitly cover but it still needs to be checked for the rest of the errors because, unfortunately, if it finds some text that it doesn’t work with, it just crashes. That being said, it’s at most a week from being a solid release candidate.

Another useful Atom package is atom-runner which lets you run scripts inside Atom via the ALT-R shortcut.  Currently, Perl 6 is not natively supported but atom-runner provides a simple configuration that allows you to add support for any script, and here’s all you’d have to add to your `config.cson` to make it work:


runner:
    scopes:
        perl6: "perl6"
        perl6fe: "perl6"

Technically, the last entry is all that’s needed if you’re using language-perl6fe but you may wish to include both for redundancy.


I hope I’ve shown why Atom Editor is a great choice for programming in Perl 6. To whet your appetite, I have plans to also work on adding autocomplete-plus support, atom-build support and atom-runner support (without adding to config.cson). If you are ready to take Atom + Perl 6 to the next level it’s currently possible to use universal-ctags but it requires editing the souce of atom-ctags to use universal ctags instead of exuberant ctags. (If you have any questions about getting ctags to work or Atom Editor in general, please comment or find me on irc!)

One thought on “Day 3 – Atom Editor support

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s