spadarian / docblock-python

Atom plugin to insert documentation blocks for python functions
GNU General Public License v2.0
22 stars 9 forks source link

Uncaught TypeError: Cannot read property '0' of null #17

Closed sdwill closed 6 years ago

sdwill commented 6 years ago

[Enter steps to reproduce:]

  1. Create a new Python function whose argument list extends over two or more lines
  2. Invoke docblock-python on the line containing the function name to generate docstring

Atom: 1.29.0 x64 Electron: 2.0.5 OS: Microsoft Windows 10 Pro Thrown From: docblock-python package 0.9.1

Stack Trace

Uncaught TypeError: Cannot read property '0' of null

At C:\Users\sdwil\.atom\packages\docblock-python\lib\docblock-python.js:260

TypeError: Cannot read property '0' of null
    at Object.process_def (/packages/docblock-python/lib/docblock-python.js:260:36)
    at /packages/docblock-python/lib/docblock-python.js:189:45
    at Array.map (<anonymous>)
    at /packages/docblock-python/lib/docblock-python.js:163:14
    at Object.generate_docblock (/packages/docblock-python/lib/docblock-python.js:227:12)
    at HTMLElement.docblockPythonGenerate_docblock (/packages/docblock-python/lib/docblock-python.js:107:55)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.29.0/resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (~/AppData/Local/atom/app-1.29.0/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (~/AppData/Local/atom/app-1.29.0/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (~/AppData/Local/atom/app-1.29.0/resources/app/src/window-event-handler.js:110:40)

Commands

     -5:12.7.0 core:select-up (input.hidden-input)
     -5:12.1.0 core:backspace (input.hidden-input)
     -5:11.7.0 editor:newline (input.hidden-input)
  6x -5:08.3.0 editor:delete-to-beginning-of-word (input.hidden-input)
     -0:35.7.0 core:select-all (input.hidden-input)
     -0:21.7.0 core:move-down (input.hidden-input)
     -0:21.6.0 editor:select-to-end-of-word (input.hidden-input)
     -0:20.9.0 core:move-up (input.hidden-input)
     -0:20.6.0 core:move-down (input.hidden-input)
     -0:20.4.0 core:move-right (input.hidden-input)
  2x -0:19.9.0 core:select-up (input.hidden-input)
     -0:19.6.0 editor:select-to-beginning-of-word (input.hidden-input)
     -0:19.2.0 core:backspace (input.hidden-input)
     -0:18 docblock-python:generate_docblock (input.hidden-input)
  2x -0:16.2.0 core:move-up (input.hidden-input)
     -0:14.6.0 docblock-python:generate_docblock (input.hidden-input)

Non-Core Packages

atom-beautify 0.32.5 
atom-ctags 5.1.2 
atom-dark-fusion-syntax 2.2.1 
atom-file-icons 0.6.0 
atom-ide-ui 0.13.0 
atom-material-syntax 1.0.8 
atom-ungit 0.8.0 
block-comment-plus 0.5.1 
code-peek 1.4.21 
default-language 0.3.1 
docblock-python 0.9.1 
duotone-blue-dark-syntax 1.4.0 
duotone-dark-sea-syntax 2.1.0 
duotone-dark-space-syntax 2.1.0 
duotone-dark-syntax 2.1.0 
duotone-light-syntax 2.1.0 
duotone-snow 2.2.0 
electron-light-syntax 1.4.0 
file-icons 2.1.22 
flat-ui-syntax 0.5.1 
fuzzy-theme-switcher 1.0.0 
git-diff-details 1.4.0 
git-plus 8.0.0 
git-time-machine 2.1.0 
hey-pane 1.1.0 
hidpi 0.14.0 
Hydrogen 2.5.1 
hydrogen-launcher 1.2.2 
hydrogen-python 0.0.6 
ide-python 1.0.0 
language-diff 0.7.0 
language-gitignore 0.3.0 
language-latex 1.1.1 
Lucario 2.2.0 
MagicPython 1.0.12 
monokai-one-dark-vivid-syntax 1.6.0 
nord-atom-syntax 0.9.1 
nord-atom-ui 0.11.0 
one-dark-vivid-syntax 1.8.1 
pdf-view 0.70.0 
pen-paper-coffee-syntax 0.17.0 
platformio-ide-terminal 2.8.3 
python-autopep8 0.1.3 
python-indent 1.1.5 
python-tools 0.6.9 
solarized-light-syntax-modified 0.6.2 
spacegray-light-syntax 0.1.0 
split-diff 1.5.2 
theme-switcher 1.1.0 
spadarian commented 6 years ago

Can you send a snippet with the function definition?

sdwill commented 6 years ago

Here's a very simple example of something that fails with the above error:

def some_function(first_argument, 
                  second_argument):
    pass

There is nothing special about this example- I first discovered the issue when attempting to create docblocks for actual functions whose argument list extended over multiple lines.

spadarian commented 6 years ago

@sdwill Let me know if the last patch fixed your problem.

sdwill commented 6 years ago

Yes it did. Thanks!