Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

focusEditor() does not work From active Pane Item #384

Description

@JakeIwen

if a non- TextEditor pane is selected, focusEditor() is called via atom.workspace.onDidChangeActivePaneItem( in atom-ternjs-manager.js.

I believe this break happened in Release 0.18.0

see this issue for an example of the problem it causes

Here's my patch in atom-ternjs-helper.js

export function focusEditor() {

 // const editor = atom.workspace.getActiveTextEditor();
 // getActiveTextEditor() will return the last focused textEditor, and re-focus it at the end of this function

  const editor = atom.workspace.getActivePaneItem();
  // Instead use getActivePaneItem() and isValidEditor() to determine editor validity. 

  // if (!editor) { // this condition pretty much never met with getActiveTextEditor()
  if (!isValidEditor(editor)) {
    
    return;
    
  }

  const view = atom.views.getView(editor);

  view && view.focus && view.focus();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions