Setup Atom Editor for MOOSE
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.
Start Atom for the first time and select _Atom->Install Shell Commands_. This activates the
apmshell commands for use from a terminal.
Close Atom. From now on we will only start it from our MOOSE project directories using
atomensuring that Atom sees the full MOOSE build environment.
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!
Tip: To install a plugin, use the "apm" command on your terminal:
apm install switch-header-source
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.
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
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
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
Leave that terminal open in the background and get back to your old terminal. Then change into your application directory (or
moose/modules) and run
MOOSE_UNITY=false 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