Is There An Event Triggered When Tabs Are Changed / Active Editor Changes


In developing the go-plus package, I would like to ensure that when a user switches tabs or changes the active editor that I hide the errors pane we display if a gofmt or go vet error is identified.

I’d like to attach some behavior to this event to reset the state of the plugin:

Does such an event exist, or do you know of any creative ways for me to simulate this behavior?


Looks like Event to focus and unfocus to a tab (EditorView)? might offer some insight into this. Of note, the event mentioned is not documented here: or the View docs.

Docs feature enhancement?


It is common feedback that the documentation does not yet include comprehensive listings of events or properties. If you have detailed feedback for how the Atom team can make writing packages easier, you can add it here:


Here is an “unofficial” list of events

What you can do for now (until the documentation gets better) is search for an event on GitHub and see if any of the official packages use it and take that as an example.

Search query: active-pane-item-changed user:atom


We now have :

It works but I am being super defensive in making sure the pane is an editor though in my code.

function onDiskAndTs(editor) {
    if (editor && editor.getPath && typeof editor.getPath == "function") {
        var filePath = editor.getPath();
        var ext = path.extname(filePath);
        if (ext == '.ts') {
            if (fs.existsSync(filePath)) {
                return true;
    return false;


You could also do …

{TextEditor} = require ‘atom’

if editor instanceof TextEditor then blah blah blah


I found a way:

atom.workspace.observeActivePaneItem (item) ->
    console.log 'how are you'
    ... do your staff here ...

when you switch tab, your code will be triggered

it works for Atom 1.2.4, hehe


I believe Google is best in writing documentation and that’s because they have included examples as well.