BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Atom 1.13 Brings Benchmarks, Project History, and Keystroke Resolver API

Atom 1.13 Brings Benchmarks, Project History, and Keystroke Resolver API

This item in japanese

Version 1.13 of Atom, GitHub’s Electron-based open source text editor, adds a host of new features and improvements for users and developers, including a benchmarking tool, a Reopen Project menu option and API, and a custom keystroke resolver to map Chrome keyboard events to Atom-style keystrokes.

Previous to Atom 1.13, the only way to measure how changes in Atom’s codebase affect performance was using Chrome’s profiler. Atom 1.13 introduces a new atom --benchmark option that allows developers to run benchmarks on their machine and compare how different versions of Atom compare when running the same benchmark. The benchmark command is also available from the command palette invoking Window: Run Benchmarks and will execute all benchmarks found in the benchmarks directory. If you invoke atom --benchmark, you will get a textual output in CSV format; otherwise, Atom will plot the benchmark on screen.

To make it possible to go back to a previous editor state without resorting to using unusual command line options, version 1.13 introduces a new Reopen Project command and a related atom.history API. The new API includes the .getProjects(), .clearProjects(), and .onDidChangeProjects(callback) endpoints. The number of cached project names can be defined using core.reopenProjectMenuCount and defaults to 15.

Additionally, Atom 1.13 adds a new keystroke resolver API which aims to solve a number of bugs related to keyboard event handling by allowing to define how to interpret keystrokes:

atom.keymaps.addKeystrokeResolver(({event}) => {
  if (event.code === 'KeyG' && event.altKey && event.ctrlKey) {
    return 'ctrl-@'
  }
})

In particular, this should help improve keyboard event handling when modifier keys are used and with international layout.

As a final note, Atom 1.13 pulls back the Shadow DOM boundary, which was used to render the editor’s contents inside a protected namespace to avoid conflicts between styles belonging to the editor and styles intended for other elements in the workspace. The Shadow DOM boundary approach suffered from a number of issues and has been replaced in version 1.13 by the Light DOM, an approach that consists in prepending syntax-- to syntactic class names, e.g.:

.syntax--source.syntax--js .syntax--operator {
  color: #000000;
}

Atoms provides a guide describing the process of removing Shadow DOM styles from existing themes or packages. The required changes are not backward-compatible, meaning that an upgraded theme or package will not be able to run in versions of Atom prior to 1.13.

Rate this Article

Adoption
Style

BT