fcrespo82 / atom-markdown-table-formatter

A simple markdown plugin to format tables.
MIT License
21 stars 7 forks source link

Uncaught TypeError: event.target.getModel is not a FUNCTION #18

Closed rugk closed 9 years ago

rugk commented 9 years ago

[Enter steps to reproduce below:]

  1. Run formatter.

Atom Version: 1.0.15 System: Windows 7 Thrown From: markdown-table-formatter package, v2.5.3

Stack Trace

Uncaught TypeError: event.target.getModel is not a function

At C:\Users\%username%\.atom\packages\markdown-table-formatter\lib\markdown-table-formatter.coffee:33

TypeError: event.target.getModel is not a function
  at atom-text-editor.<anonymous> (C:\Users\%username%\.atom\packages\markdown-table-formatter\lib\markdown-table-formatter.coffee:31:47)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\src\command-registry.js:245:29)
  at C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\src\command-registry.js:3:61
  at CommandPaletteView.module.exports.CommandPaletteView.confirmed (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\node_modules\command-palette\lib\command-palette-view.js:159:32)
  at CommandPaletteView.module.exports.SelectListView.confirmSelection (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:338:21)
  at space-pen-div.atom.commands.add.core:confirm (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:109:19)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\src\command-registry.js:245:29)
  at C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\src\command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:524:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:347:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (C:\Users\%username%\AppData\Local\atom\app-1.0.15\resources\app.asar\src\window-event-handler.js:184:20)

Commands

     -1:05.0 core:undo (input.hidden-input)
     -1:00.9.0 core:backspace (input.hidden-input)
     -1:00.2.0 editor:newline (input.hidden-input)
     -0:59.6.0 core:move-up (input.hidden-input)
     -0:53.9.0 editor:newline (input.hidden-input)
     -0:49.6.0 core:backspace (input.hidden-input)
     -0:46.4.0 core:move-up (input.hidden-input)
  6x -0:43.4.0 core:backspace (input.hidden-input)
     -0:19.8.0 core:copy (input.hidden-input)
  2x -0:18.9.0 core:paste (input.hidden-input)
  2x -0:12 editor:newline (input.hidden-input)
     -0:11.1.0 command-palette:toggle (input.hidden-input)
     -0:08.2.0 core:confirm (input.hidden-input)
     -0:08.2.0 markdown-table-formatter:format (input.hidden-input)
     -0:05.2.0 command-palette:toggle (input.hidden-input)
  3x -0:03.1.0 core:backspace (input.hidden-input)

Config

[...]

Installed Packages

# User
[...]

# Dev
No dev packages
lierdakil commented 9 years ago

Can't reproduce given your instructions. I'm afraid you'll have to be a little bit more specific...

rugk commented 9 years ago

It shows this every time I execute it. Try it on a part where there is no table and maybe you'll see it.

lierdakil commented 9 years ago

Look, I just tried. And this error suggests that you're executing command, specifically locked to editor, on non-editor elements, which doesn't really make much sense.

Which leaves us with a couple options. Either this is a bug in Atom, some weird conflict with another package, or some strange configuration. Now you omitted both list of packages and your config, so I can't test for last two. So you'll have to work with me on this.

You can try a couple things:

  1. Restart Atom
  2. Disable all other user packages
  3. Reinstall markdown-table-formatter
  4. Reinstall Atom (well, maybe not yet)
rugk commented 9 years ago

Now you omitted both list of packages and your config, so I can't test for last two.

You won't image how long the package list is... My config:

{
  "core": {
    "projectHome": "D:\\Users\\%username%\\GitHub",
    "disabledPackages": [
      "metrics",
      "autocomplete-emojis",
      "highlight-column",
      "character-table",
      "placeholder-text",
      "ask-stack",
      "tree-view-breadcrumb",
      "tree-view-background",
      "markdown-scroll-sync"
    ],
    "themes": [
      "atom-dark-ui",
      "one-dark-syntax"
    ]
  },
  "markdown-table-formatter": {}
}
rugk commented 9 years ago

I'll test the other things soon.

rugk commented 9 years ago

Strange - after reinstalling Atom and all my previously installed packages I could not reproduce this bug any more...

lierdakil commented 9 years ago

I'll just chalk it up to corrupted installation -- it can happen sometimes, thankfully rarely enough. Thanks for testing!