focusaurus/atom-format-shell

Uncaught TypeError: Cannot read property 'getText' of undefined

Closed this issue · 3 comments

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.33.1 x64
Electron: 2.0.16
OS: Microsoft Windows 10 Pro
Thrown From: format-shell package 2.0.0

Stack Trace

Uncaught TypeError: Cannot read property 'getText' of undefined

At C:\Users\LightRoom\.atom\packages\format-shell\lib\format-shell.js:58

TypeError: Cannot read property 'getText' of undefined
    at Object.format (/packages/format-shell/lib/format-shell.js:58:36)
    at HTMLElement.formatShellFormat (/packages/format-shell/lib/format-shell.js:19:41)
    at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.33.1/resources/app/static/<embedded>:11:350034)
    at CommandRegistry.dispatch (~/AppData/Local/atom/app-1.33.1/resources/app/static/<embedded>:11:348509)
    at AtomEnvironment.dispatchApplicationMenuCommand (~/AppData/Local/atom/app-1.33.1/resources/app/static/<embedded>:1:669041)
    at EventEmitter.t (~/AppData/Local/atom/app-1.33.1/resources/app/static/<embedded>:1:676425)
    at emitThree (events.js:136:13)
    at EventEmitter.emit (events.js:217:7)

Commands

     -2:18.9.0 core:undo (input.hidden-input)
     -2:17.9.0 intentions:highlight (input.hidden-input)
     -2:17.8.0 core:undo (input.hidden-input)
     -2:17 vim-mode-plus:activate-blockwise-visual-mode (input.hidden-input)
     -2:13.8.0 core:paste (div.highlights)
 58x -2:11.7.0 core:move-left (input.hidden-input)
     -1:06.4.0 core:paste (div.highlights)
     -1:00.4.0 core:delete (input.hidden-input)
     -0:53.7.0 grammar-selector:show (atom-text-editor.editor.vim-mode-plus.is-focused.normal-mode)
     -0:33.8.0 vim-mode-plus:move-right (input.hidden-input)
  2x -0:32.1.0 vim-mode-plus:move-down-to-edge (input.hidden-input)
     -0:25.6.0 vim-mode-plus:move-down (input.hidden-input)
     -0:25.6.0 vim-mode-plus:move-up (input.hidden-input)
 35x -0:25.4.0 vim-mode-plus:move-down (input.hidden-input)
     -0:17 tabs:close-all-tabs (input.hidden-input)
     -0:06.0 format-shell:format (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)

Non-Core Packages

atom-bash 1.1.1 
Atom-Bash-Snippets 0.0.3 
autocomplete-bash-builtins 0.3.5 
build 0.70.0 
build-powershell 0.11.0 
busy-signal 2.0.0 
format-shell 2.0.0 
ide-bash 1.0.11 
intentions 1.1.5 
linter 2.2.0 
linter-checkbashisms 0.1.5 
linter-shellcheck 1.5.0 
linter-ui-default 1.7.1 
open-bash-git 2.3.3 
TerminalColor 1.1.0 
vim-mode-plus 1.36.0 

Thanks for the bug report! Based on the stack trace and commands, here's my guess as to what's going on. Could you confirm if you closed all your open tabs (tabs:close-all-tabs) then triggered the format-shell command? It looks like the command was running when there was no active editor. Easy to fix the crash, but since there's no active editor, I'll just have the code do nothing.

Should be fixed in v2.1.6 hopefully.