atomio.png
Screenshot of Atom in action.
Atom is a text editor developed by GitHub with a flexible plugin structure. Several plugins are available to customize Atom for MOOSE development, some specifically developed for MOOSE.

Setting up Atom

Installation packages can be downloaded for Mac, Linux, and Windows operating systems from the Atom website. The editor has an automatic update system for both the core editor as well as the installed plugins.

First Steps

  • Start Atom for the first time and select Atom->Install Shell Commands. This activates the atom and apm shell commands for use from a terminal.
  • Close Atom. From now on we will only start it from our MOOSE project directories using atom . ensuring that Atom sees the full MOOSE build environment.

Important commands

atomio2.png
Opening new files with the fuzzy search (Cmd-T).

  • Cmd-Shift-P opens the command palette. Every available Atom command can be accessed by typing a few letters here. The dropdown list shows the keyboard shortcuts.
  • Cmd-T opens a file anywhere in the current project tree (i.e. below the directory in which you issued the atom . command. No need to know the precise path or even the precise spelling of the filename!

Plugins

Tip: To install a plugin, use the "apm" command on your terminal:

$ apm install switch-header-source

687474703a2f2f692e696d6775722e636f6d2f564e7a7454374f2e676966.gif
Autocompletion for MOOSE input files (click for animation)
The following plugins should be installed to effectively develop MOOSE based codes and edit MOOSE input files using Atom

  • switch-header-source - Use Ctrl-Alt-S to switch between corresponding header and source files.
  • language-moose - Syntax highlighting and automatic indentation for MOOSE input files, C++ code snippets for all MOOSE systems, and highlighting of select MOOSE C++ types.
  • autocomplete-moose - Context sensitive autocompletion for MOOSE input files.
  • make-runner - Press Ctrl-R to build the current project from within Atom. Features clickable compile error messages to jump straight to the locations with the compile errors.
  • autocomplete-clang - Type-aware C++ autocompletion. Use make clang_complete in your project directory to generate the necessary configuration file.
  • clang-format - Uses clang-format with the custom MOOSE style rules to format your code. Can be set to reformat automatically when saving or manually by pressing Cmd-Shift-K.
  • atomic-rtags - uses the rtags demon (live indexing of the C++ symbols in your source tree) to provide a jump to declaration feature. See below how to set-up rtags with MOOSE
  • atom-rtags-plus is the advanced rtags plugin. In addition to jump to declaration it supports refactoring, autocompletion, list references and many more.
  • In the whitespace core package (Settings->Packages search for 'whitespace') deactivate Ignore Whitespace On Current Line.

Source navigation with rtags

Download and build rtags

git clone https://github.com/Andersbakken/rtags.git
cd rtags/
git submodule init
git submodule update
mkdir mybuild && cd mybuild
cmake ..
make -j 24
sudo make install

Start the rtags demon in a separate terminal

rdm

Leave that terminal open in the background and get back to your old terminal. Then change into your application directory (or moose/modules/combined) and run

make compile_commands.json
rc -J .

This will cause make to transmit a list of all compile commands to the rtags demon. The rtags demon will immediately start indexing all MOOSE source code files (you can observe the process in the rdm terminal window).

You can now press alt+, in Atom with the cursor on any symbol (even macros) to jump to its declaration courtesy of the atomic-rtags package.

Using Atom behind a proxy

To enable update checking and plugin installation proxy information must be entered in a configuration file at ~/.atom/.apmrc (create the file as needed) as

proxy = http://server:port
http-proxy = http://server:port
http_proxy = http://server:port
https_proxy = http://server:port