vincentcn / markdown-scroll-sync

Auto-scroll markdown-preview tab to match markdown source
MIT License
95 stars 26 forks source link

Causes an error when source-preview pane is opened #44

Closed danielbayley closed 8 years ago

danielbayley commented 8 years ago

Opening a source-preview pane triggers the following error from this package…

Atom Version: 1.4.3 System: Mac OS X 10.11.3 Thrown From: markdown-scroll-sync package, v2.1.1

Stack Trace

Uncaught TypeError: Cannot read property 'split' of undefined

At /Users/Dan/Library/Application%20Support/Atom/packages/markdown-scroll-sync/lib/main.coffee:44

TypeError: Cannot read property 'split' of undefined
    at isMarkdown (/Users/Dan/Library/Application Support/Atom/packages/markdown-scroll-sync/lib/main.coffee:29:46)
    at /Users/Dan/Library/Application Support/Atom/packages/markdown-scroll-sync/lib/main.coffee:33:10
    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 /Applications/Atom.app/Contents/Resources/app.asar/src/pane-container.js:333:27
    at Pane.module.exports.Pane.observeActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:196:7)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/pane-container.js:331:42
    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 PaneContainer.module.exports.PaneContainer.setActivePane (/Applications/Atom.app/Contents/Resources/app.asar/src/pane-container.js:196:22)
    at Pane.module.exports.Pane.activate (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:623:15)
    at Pane.module.exports.Pane.split (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:712:15)
    at Pane.module.exports.Pane.splitRight (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:672:19)
    at PreviewView.module.exports.PreviewView.show (/Users/Dan/Library/Application Support/Atom/packages/source-preview/lib/preview-view.coffee:111:23)
    at Object.module.exports.toggle (/Users/Dan/Library/Application Support/Atom/packages/source-preview/lib/main.coffee:33:13)
    at atom-text-editor.subscriptions.add.atom.commands.add.source-preview:toggle (/Users/Dan/Library/Application Support/Atom/packages/source-preview/lib/main.coffee:13:47)
    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:536:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:359:22)
    at KeymapManager.module.exports.KeymapManager.terminatePendingState (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:510:14)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:386:23)
    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

     -4:41 editor:move-to-end-of-screen-line (atom-text-editor.editor.is-focused)
     -4:40.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -4:40.1.0 editor:newline (atom-text-editor.editor.is-focused)
  7x -4:38.5.0 core:undo (atom-text-editor.editor.is-focused)
     -4:32.4.0 core:save (atom-text-editor.editor.is-focused)
  2x -4:27.6.0 editor:toggle-soft-wrap (atom-text-editor.editor.is-focused)
     -4:22.4.0 core:backspace (atom-text-editor.editor.is-focused)
     -4:22.2.0 editor:newline (atom-text-editor.editor.is-focused)
     -4:21.3.0 core:backspace (atom-text-editor.editor.is-focused)
     -4:21 editor:newline (atom-text-editor.editor.is-focused)
     -4:19.3.0 core:save (atom-text-editor.editor.is-focused)
  4x -4:12.7.0 source-preview:toggle (atom-text-editor.editor.is-focused)
  2x -3:30.4.0 editor:move-to-first-character-of-line (atom-text-editor.editor.is-focused)
  4x -3:29 core:backspace (atom-text-editor.editor.is-focused)
     -3:18.8.0 core:save (atom-text-editor.editor.is-focused)
  3x -1:34.7.0 source-preview:toggle (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "customFileTypes": {
      "source.js": [
        "ffx"
      ],
      "text.xml": [
        "als",
        "sdef"
      ],
      "text.xml.plist": [
        "plist"
      ]
    },
    "disabledPackages": [
      "autocomplete",
      "remember-session",
      "file-type-icons",
      "red-wavy-underline",
      "color-gutter",
      "word-count",
      "seti-icons",
      "livereload",
      "environment",
      "test-status",
      "tree-view-breadcrumb",
      "circle-ci",
      "travis-ci-status",
      "regex-railroad-diagram",
      "Zen",
      "metrics",
      "project-environment",
      "language-dots",
      "language-env",
      "plist-converter",
      "build",
      "pigments",
      "markdown-toc",
      "contextual-preview",
      "emmet",
      "keybinding-cheatsheet",
      "language-cjsx",
      "url-tidy",
      "multiple-keymaps",
      "preview",
      "synced-sidebar",
      "git-travel",
      "tree-view-git-branch",
      "tree-view-git-projects",
      "package-templates",
      "follow-finder-aliases",
      "new-tab",
      "linter-scss-lint",
      "atom-react-preview",
      "env-from-shell",
      "imdone-atom",
      "tablr"
    ],
    "ignoredNames": [
      ".DS_Store",
      "._*",
      "Icon",
      ".git",
      "*.pyc",
      "*.rsrc"
    ],
    "openEmptyEditorOnStart": false,
    "projectHome": "~/Library/Application Support/Atom/dev/packages",
    "themes": [
      "nucleus-dark-ui",
      "adventurous-syntax"
    ]
  }
}

Installed Packages

# User
adventurous-syntax, v0.2.0
api-docs, v0.0.3
atom-beautify, v0.28.21
atom-calca, v0.3.0
atom-html-preview, v0.1.13
atom-smart-tabs, v0.1.0
atom-touch-events, v0.23.0
auto-detect-indentation, v0.4.2
auto-update-packages, v1.0.0
autoclose-html, v0.20.0
autocomplete-html-entities, v0.1.0
autocomplete-json, v1.5.0
autocomplete-modules, v1.3.1
autocomplete-paths, v1.0.2
autocomplete-ruby, v0.1.0
autocomplete-sass, v0.1.0
autocomplete-swift, v1.0.1
autohide-tree-view, v0.25.1
bezier-curve-editor, v0.7.2
browser-plus, v0.0.54
build-npm-apm, v0.8.0
build-xcodebuild, v0.1.0
clipboard-plus, v0.5.1
coffee-porter, v0.8.1
color-picker, v2.1.1
copy-path, v0.3.1
cson, v2.0.1
css-snippets, v0.9.0
custom-title, v1.0.1
default-language, v0.2.0
disable-grammars, v0.1.1
disable-keybindings, v0.6.0
editorconfig, v1.2.4
external-open, v0.6.1
file-icons, v1.6.14
file-types, v0.5.1
flex-tool-bar, v0.7.3
flexbox-snippets, v0.3.0
html-id-class-snippets, v1.4.1
jQuery, v1.2.1
jade-snippets, v0.5.0
language-ansible, v0.1.3
language-apache, v1.4.0
language-gitignore, v0.2.0
language-haml, v0.23.15
language-jade, v0.6.3
language-postcss, v1.1.3
language-svg, v0.9.0
language-swift, v0.4.0
linter, v1.11.3
linter-ansible-lint, v0.0.7
linter-coffeelint, v1.1.2
linter-doiuse, v0.2.3
linter-htmlhint, v1.0.2
linter-jade, v0.3.2
linter-js-yaml, v1.2.5
linter-jshint, v1.3.0
linter-jsonlint, v1.1.5
linter-less, v2.4.0
linter-markdown, v1.4.2
linter-perl, v0.7.2
linter-rubocop, v0.4.7
linter-sass-lint, v1.0.4
linter-shellcheck, v1.1.0
linter-stylelint, v1.10.4
linter-swiftc, v2.0.0
linter-swiftlint, v1.1.0
linter-xmllint, v1.3.0
make-executable, v0.1.1
markdown-preview-plus, v2.2.2
markdown-scroll-sync, v2.1.1
markdown-table-formatter, v2.7.2
markdown-themeable-pdf, v0.10.2
move-status-items, v0.0.11
navigate, v0.1.13
new-file-plus, v0.2.1
nucleus-dark-ui, v0.7.4
open-recent, v5.0.0
package-settings, v1.0.1
pain-split, v1.4.0
pdf-view, v0.39.0
postcss-sorting, v2.1.3
project-manager, v2.7.6
react, v0.14.1
react-snippets, v0.3.0
rest-client, v0.5.0
sequential-command, v0.3.0
simple-drag-drop-text, v0.3.0
source-preview, v0.5.0
source-preview-jade, v0.1.1
source-preview-react, v0.2.0
svg-preview, v0.7.3
sync-settings, v0.6.0
tab-control, v0.6.9
tabs-to-spaces, v1.0.1
takana-atom, v0.1.0
terminal-panel, v1.14.1
text-manipulation, v0.6.0
tool-bar, v0.2.0
tree-view-git-status, v0.2.2
wordcount, v2.6.0

# Dev
atom-beautify, v0.28.15
browser-plus, v0.0.45
color-picker, v2.0.13
modular-keymaps, v0.0.0
nucleus-dark-ui, v0.6.5
terminal-panel, v1.14.1
text-manipulation, v0.6.0
clutterstack commented 8 years ago

Same error message for me. Just upgraded to v2.1.1.

On the pane with the markdown preview tab in it, I also had a tab containing an unsaved, untitled text file. Switching to this unsaved file from any other tab triggered the error.

Saving the text file (no extension needed) fixed the behaviour for me.

Atom Version: 1.4.3 System: Mac OS X 10.10.5 Thrown From: markdown-scroll-sync package, v2.1.1

Stack Trace

Uncaught TypeError: Cannot read property 'split' of undefined

At /Users/chris/.atom/packages/markdown-scroll-sync/lib/main.coffee:29

TypeError: Cannot read property 'split' of undefined
    at isMarkdown (/Users/chris/.atom/packages/markdown-scroll-sync/lib/main.coffee:29:46)
    at /Users/chris/.atom/packages/markdown-scroll-sync/lib/main.coffee:33:10
    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 /Applications/Atom.app/Contents/Resources/app.asar/src/pane-container.js:333:27
    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 Pane.module.exports.Pane.setActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:248:22)
    at Pane.module.exports.Pane.activateItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:316:21)
    at Pane.module.exports.Pane.activateItemAtIndex (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:310:19)
    at Pane.module.exports.Pane.activatePreviousItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:277:21)
    at Pane.module.exports.Pane.removeItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:391:16)
    at Pane.module.exports.Pane.destroyItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:453:16)
    at atom-tabs.TabBarView.onClick (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/tabs/lib/tab-bar-view.js:695:17)

Commands

     -0:40.2.0 core:save (atom-text-editor.editor.is-focused)
     -0:07.3.0 markdown-preview:toggle (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "openEmptyEditorOnStart": false,
    "projectHome": "/Users/chris/path/to/a/project" 
  }
}

Installed Packages

# User
clock, v1.5.0
markdown-scroll-sync, v2.1.1
terminal-plus, v0.14.5

# Dev
No dev packages
mark-hahn commented 8 years ago

Fixed in 2.1.2

Thanks.,

danielbayley commented 8 years ago

Nice one :+1: