1
votes

I ended up updating Windows and had to re-download Atom, however, I had all my settings brought over with sync-settings. All has been good except something is up with the handling of my files when I click on them in the tree view.

What used to happen was if I clicked on a file, it would open directly to it in my main window pane. Now, however, when I click on a file, it opens it up in a new tab but doesn't switch to it. I have to manually do that.

I've searched everywhere but can't seem to find a solution. Why is it handling my files this way and how can I get it to go back to the way it was?

EDIT: MY SOLUTION

Ends up my issue was the Atom Debug UI package that was causing this behaviour. Once I disabled it, everything went back to normal.

1

1 Answers

1
votes

A single click on a file in the tree-view will open a "pending tab", as indicated by the use of italics on the tab. Pending tabs are meant as previews and will be closed unless you make edits or save the file. If you do want to edit a file, you need to double-click it. I don't recall older versions of Atom behaving differently, but I might be wrong.

Since Atom boasts itself as being "the hackable text editor", you can modify its default behaviour through packages or the Init Script (by default that's ~/.atom/init.coffee).

The following CoffeeScript snippet will create an event-listener for that behaviour:

treeView = document.querySelector('.tree-view')

treeView.addEventListener 'click', ->
  editor = atom.workspace.getActiveTextEditor()
  view = atom.views.getView(editor)

  return view.focus()

Should you prefer using plain JavaScript, rename or delete your ~/.atom/init.coffee and create an init.js in the same location. The JavaScript equivalent of the above looks like this:

const treeView = document.querySelector('.tree-view');

treeView.addEventListener('click', () => {
  const editor = atom.workspace.getActiveTextEditor();
  const view = atom.views.getView(editor);

  view.focus();
});