jtokoph / auto-detect-indentation

Auto detect indentation of files in Atom
MIT License
39 stars 6 forks source link

Uncaught TypeError: Cannot read property 'getTokenIterator' of undefined #10

Closed jackocnr closed 8 years ago

jackocnr commented 8 years ago
  1. Open a file with this contents: https://gist.github.com/jackocnr/dcd20c4aca0d07849f3c
  2. Save it

Note: I've removed as many lines as I can from that file to still repro the error. If I remove any of the existing lines (inc a blank line e.g. line 27) I don't get the error any more...

Atom Version: 1.5.4 System: Mac OS X 10.11.3 Thrown From: auto-detect-indentation package, v0.5.0

Stack Trace

Uncaught TypeError: Cannot read property 'getTokenIterator' of undefined

At /Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:825

TypeError: Cannot read property 'getTokenIterator' of undefined
    at TokenizedBuffer.module.exports.TokenizedBuffer.scopeDescriptorForPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/tokenized-buffer.js:708:47)
    at DisplayBuffer.module.exports.DisplayBuffer.scopeDescriptorForBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:832:35)
    at TextEditor.module.exports.TextEditor.scopeDescriptorForBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:2428:33)
    at TextEditor.module.exports.TextEditor.isBufferRowCommented (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:2441:55)
    at Object.module.exports._loadSettingsForEditor (/Users/jack/.atom/packages/auto-detect-indentation/lib/auto-detect-indentation.coffee:33:26)
    at /Users/jack/.atom/packages/auto-detect-indentation/lib/auto-detect-indentation.coffee:13:8
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1067:27)
    at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1037:19)
    at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:630:26)
    at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:545:18)
    at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:528:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:649:35)
    at atom-workspace.commandRegistry.add.core:save (/Applications/Atom.app/Contents/Resources/app.asar/src/register-default-commands.js:173:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:570:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:378:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:97:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -8:05.3.0 core:move-down (atom-text-editor.editor.is-focused)
  2x -7:50.8.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-when-scrolling.seti-ui-no-icons.theme-one-dark-syntax.theme-one-dark-ui)
     -7:28.5.0 tree-view:remove (span.name.icon.icon-file-text)
     -7:25.4.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-when-scrolling.seti-ui-no-icons.theme-one-dark-syntax.theme-one-dark-ui)
     -7:23 tree-view:remove (span.name.icon.icon-file-text)
     -7:17.6.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-when-scrolling.seti-ui-no-icons.theme-one-dark-syntax.theme-one-dark-ui)
     -7:07.6.0 pane:split-right (atom-text-editor.editor.is-focused)
 10x -7:07.4.0 tree-view:reveal-active-file (atom-workspace.workspace.scrollbars-visible-when-scrolling.seti-ui-no-icons.theme-one-dark-syntax.theme-one-dark-ui)
     -3:26.2.0 core:copy (atom-text-editor.editor.is-focused)
  2x -3:24.6.0 editor:newline (atom-text-editor.editor.is-focused)
     -3:24.3.0 core:paste (atom-text-editor.editor.is-focused)
     -1:43.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -1:02.0 editor:newline (atom-text-editor.editor.is-focused)
     -1:01.2.0 core:move-down (atom-text-editor.editor.is-focused)
  2x -0:52.6.0 core:move-left (atom-text-editor.editor.is-focused)
  2x -0:22.5.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "customFileTypes": {
      "source.js": [
        "js.ejs"
      ]
    },
    "destroyEmptyPanes": false,
    "disabledPackages": [
      "linter-jshint",
      "linter-jsxhint"
    ],
    "openEmptyEditorOnStart": false
  }
}

Installed Packages

# User
atom-beautify, v0.28.25
auto-detect-indentation, v0.5.0
color-picker, v2.1.1
emmet, v2.4.1
file-icons, v1.6.17
highlight-selected, v0.11.2
linter, v1.11.3
linter-eslint, v7.0.0
minimap, v4.19.0
pigments, v0.24.2
react, v0.14.1
synced-sidebar, v0.4.3

# Dev
No dev packages
weotch commented 8 years ago

Same issue with this: https://gist.github.com/weotch/cb231c20179a7a65ef22

jtokoph commented 8 years ago

I'm unable to reproduce with either of these files. does it happen on every load/save of the file?

jackocnr commented 8 years ago

Yes I was getting the error every time I saved (I got very used to dismissing the error popup every time I saved). But now I don't get it any more... Perhaps it was a clash with another plugin at a specific version? I've had lots of updates recently.