adrianlee44 / atom-aligner

Easily align multi-line with support for different operators and custom configurations
https://atom.io/packages/aligner
MIT License
78 stars 3 forks source link

Uncaught TypeError: Cannot read property 'trailingComment' of undefined #55

Closed veggiemonk closed 8 years ago

veggiemonk commented 8 years ago

Steps to reproduce

  1. open the file .eslint.js
  2. try to align the rules with a comment in between Example
                'no-constant-condition': 0,
        'comma-dangle': [ 2, 'never' ],
        /***  PLUGINS / SHAREABLE CONFIGS  ***/
        'no-class/no-class': 2,
        'immutable/no-let': 2,
  1. ==> error

Atom Version: 1.7.2 System: Ubuntu 15.10 Thrown From: aligner package, v0.21.0

Stack Trace

Uncaught TypeError: Cannot read property 'trailingComment' of undefined

At /home/bisconti/.atom/packages/aligner/lib/formatter.js:92

TypeError: Cannot read property 'trailingComment' of undefined
    at Object.<anonymous> (/home/bisconti/.atom/packages/aligner/lib/formatter.js:92:28)
    at Array.forEach (native)
    at Object.module.exports.formatRange (/home/bisconti/.atom/packages/aligner/lib/formatter.js:89:13)
    at Aligner.alignAtRow (/home/bisconti/.atom/packages/aligner/lib/main.js:52:15)
    at editor.getSelectedBufferRanges.forEach (/home/bisconti/.atom/packages/aligner/lib/main.js:31:14)
    at Array.forEach (native)
    at Aligner.align (/home/bisconti/.atom/packages/aligner/lib/main.js:28:38)
    at atom-text-editor.disposables.add.atom.commands.add (/home/bisconti/.atom/packages/aligner/lib/main.js:77:12)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/opt/atom/resources/app.asar/src/command-registry.js:260:29)
    at /opt/atom/resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/opt/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/opt/atom/resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/opt/atom/resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/opt/atom/resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -3:56.4.0 core:paste (atom-text-editor.editor.is-focused)
  2x -3:54.6.0 core:backspace (atom-text-editor.editor.is-focused)
     -3:52.7.0 editor:move-to-first-character-of-line (atom-text-editor.editor.is-focused)
     -3:52.5.0 core:delete (atom-text-editor.editor.is-focused)
     -3:50.3.0 atom-beautify:beautify-editor (atom-text-editor.editor.is-focused)
     -3:37.1.0 docblockr:parse-enter (atom-text-editor.editor.is-focused)
     -3:37.1.0 editor:newline (atom-text-editor.editor.is-focused)
     -3:36.7.0 core:paste (atom-text-editor.editor.is-focused)
  2x -3:35.6.0 editor:move-to-beginning-of-word (atom-text-editor.editor.is-focused)
     -3:34 core:delete (atom-text-editor.editor.is-focused)
     -3:33.7.0 editor:move-to-first-character-of-line (atom-text-editor.editor.is-focused)
     -3:33.4.0 core:delete (atom-text-editor.editor.is-focused)
  2x -3:29.1.0 core:save (atom-text-editor.editor.is-focused)
  2x -0:24.1.0 core:move-left (atom-text-editor.editor.is-focused)
     -0:16.1.0 core:save (atom-text-editor.editor.is-focused)
  2x -0:04.3.0 aligner:align (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "language-c",
      "language-clojure",
      "language-csharp",
      "language-objective-c",
      "language-perl",
      "language-php",
      "encoding-selector",
      "language-ruby-on-rails",
      "language-ruby",
      "turbo-javascript",
      "language-java",
      "git-time-machine"
    ],
    "packagesWithKeymapsDisabled": [
      "editing-diff",
      "move-panes",
      "markdown-toc",
      "refactor",
      "js-refactor",
      "git-diff",
      "git-time-machine"
    ],
    "projectHome": "/home/veggiemonk/code",
    "themes": [
      "one-light-ui",
      "solarized-light-js-syntax"
    ]
  },
  "aligner": {
    "alignComments": true
  }
}

Installed Packages

# User
aligner, v0.21.0
atom-beautify, v0.29.7
atom-sync, v0.7.3
atom-ternjs, v0.14.1
auto-detect-indentation, v1.0.0
clipboard-plus, v0.5.1
color-picker, v2.1.1
cursor-history, v0.5.9
docblockr, v0.7.3
editorconfig, v1.4.0
file-icons, v1.7.7
highlight-line, v0.11.1
hyperclick, v0.0.36
imdone-atom, v1.3.29
indent-guide-improved, v1.4.5
js-hyperclick, v1.4.2
language-babel, v2.18.2
language-docker, v1.1.6
linter, v1.11.4
linter-docker, v0.1.2
linter-eslint, v7.2.1
linter-js-yaml, v1.2.5
linter-shellcheck, v1.2.0
local-history, v3.2.3
markdown-scroll-sync, v2.1.2
merge-conflicts, v1.4.2
pigments, v0.26.0
solarized-light-js-syntax, v1.1.0
ssh-config, v0.10.1
sync-settings, v0.7.2
tabs-to-spaces, v1.0.2
wakatime, v5.0.8

# Dev
No dev packages
adrianlee44 commented 8 years ago

Thanks for report this. Taking a look.

adrianlee44 commented 8 years ago

This is fixed with v0.22.0. Thanks!

veggiemonk commented 8 years ago

@adrianlee44 cool. Thanks a lot! It works very nicely