Osmose / advanced-open-file

Open files and folders in Atom easily.
https://atom.io/packages/advanced-open-file
Other
118 stars 20 forks source link

Open file UI doesn't work if no editor windows are open (in atom 1.17.0-beta0) #143

Closed rogerhub closed 7 years ago

rogerhub commented 7 years ago

The line that throws the exception is this.pathEditor = this.pathInput.getModel();. When I inspect this.pathInput, it seems to be a generic HTMLElement with no getModel and no custom constructor. So, I suspect that the atom-text-editor element isn't registered by the time the shortcut is activated.

Adding this to my init.coffee seems to fix the problem, but advanced-open-file should probably require() text-editor-element somehow:

require('/usr/share/atom-beta/resources/app/src/text-editor-element.js')

FYI I'm using Atom 1.17.0-beta0.

Steps to reproduce:

  1. Open a new window (ensure that no editor windows are open).
  2. Press keyboard shortcut to toggle advanced-open-file (ctrl-alt-O on Linux).
  3. Observe exception thrown.

Atom: 1.17.0-beta0 x64 Electron: 1.3.14 OS: Ubuntu 14.04.5 Thrown From: advanced-open-file package 0.16.6

Stack Trace

Failed to activate the advanced-open-file package

At this.pathInput.getModel is not a function

TypeError: this.pathInput.getModel is not a function
    at /packages/advanced-open-file/lib/view.js:34:42)
    at /packages/advanced-open-file/lib/controller.js:23:21)
    at Object.activate (/packages/advanced-open-file/lib/advanced-open-file.js:12:18)
    at Package.module.exports.Package.activateNow (/usr/share/atom-beta/resources/app/src/package.js:253:1)
    at /usr/share/atom-beta/resources/app/src/package.js:968:1
    at Function.module.exports.Emitter.simpleDispatch (/usr/share/atom-beta/resources/app/node_modules/event-kit/lib/emitter.js:25:1)
    at Emitter.module.exports.Emitter.emit (/usr/share/atom-beta/resources/app/node_modules/event-kit/lib/emitter.js:129:1)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom-beta/resources/app/src/command-registry.js:246:1)
    at /usr/share/atom-beta/resources/app/src/command-registry.js:3:1
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom-beta/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:1)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom-beta/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:1)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom-beta/resources/app/src/window-event-handler.js:100:1)
    at HTMLDocument.<anonymous> (/usr/share/atom-beta/resources/app/src/window-event-handler.js:3:1)

Commands

     -0:01.9.0 advanced-open-file:toggle (atom-pane.pane)

Non-Core Packages

advanced-open-file 0.16.6
auto-detect-indentation 1.3.0
language-bazel 0.3.2
language-protobuf 0.7.1
language-puppet 0.17.0
python-indent 1.0.2
vim-mode-plus 0.88.0
rogerhub commented 7 years ago

Closing this, since https://github.com/atom/atom/pull/14194 seems to fix it.