jasongilman / proto-repl

A Clojure Development Environment package for the Atom editor
https://atom.io/packages/proto-repl
MIT License
565 stars 50 forks source link

TypeError if I trigger 'editor:newline-above' in repl by shift-enter #312

Open focusaurus opened 5 years ago

focusaurus commented 5 years ago

Getting a crash in atom core when in a proto repl buffer with shift-enter bound to editor:newline-above. If I disable that key mapping, the repl evaluates the form properly.

  1. Install proto-repl atom package
  2. Add proto-repl to project.clj
  3. Start a lein repl in a docker container exposing port 9999
  4. In atom, connect to that remote nrepl (repl output in atom looks like all is well for that "Refresh complete")
  5. Type (+ 7 5) below the repl dashed line and hit shift+enter

Atom: 1.30.0 x64 Electron: 2.0.5 OS: Linux Mint Thrown From: Atom Core

Stack Trace

Uncaught TypeError: Cannot read property 'end' of undefined

At /usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:982

TypeError: Cannot read property 'end' of undefined
    at Selection.insertText (/usr/share/atom/resources/app/src/selection.js:504:60)
    at result.mutateSelectedText.selection (/usr/share/atom/resources/app/src/text-editor.js:1382:37)
    at getSelectionsOrderedByBufferPosition.map (/usr/share/atom/resources/app/src/text-editor.js:1430:92)
    at Array.map (<anonymous>)
    at transact (/usr/share/atom/resources/app/src/text-editor.js:1430:66)
    at TextBuffer.module.exports.TextBuffer.transact (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:975:24)
    at TextEditor.transact (/usr/share/atom/resources/app/src/text-editor.js:2002:30)
    at mergeIntersectingSelections (/usr/share/atom/resources/app/src/text-editor.js:1429:25)
    at TextEditor.mergeSelections (/usr/share/atom/resources/app/src/text-editor.js:3419:26)
    at TextEditor.mergeIntersectingSelections (/usr/share/atom/resources/app/src/text-editor.js:3390:42)
    at TextEditor.mutateSelectedText (/usr/share/atom/resources/app/src/text-editor.js:1428:23)
    at TextEditor.insertText (/usr/share/atom/resources/app/src/text-editor.js:1381:31)
    at TextEditor.object.(anonymous function) [as insertText] (/usr/share/atom/resources/app/node_modules/underscore-plus/lib/underscore-plus.js:77:33)
    at TextEditor.insertNewline (/usr/share/atom/resources/app/src/text-editor.js:1396:23)
    at TextEditor.object.(anonymous function) [as insertNewline] (/usr/share/atom/resources/app/node_modules/underscore-plus/lib/underscore-plus.js:77:33)
    at transact (/usr/share/atom/resources/app/src/text-editor.js:1830:18)
    at TextBuffer.module.exports.TextBuffer.transact (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:975:24)
    at TextEditor.transact (/usr/share/atom/resources/app/src/text-editor.js:2002:30)
    at TextEditor.insertNewlineAbove (/usr/share/atom/resources/app/src/text-editor.js:1823:16)
    at TextEditor.editor:newline-above (/usr/share/atom/resources/app/src/register-default-commands.js:651:27)
    at /usr/share/atom/resources/app/src/register-default-commands.js:705:40
    at TextBuffer.module.exports.TextBuffer.transact (/usr/share/atom/resources/app/node_modules/text-buffer/lib/text-buffer.js:975:24)
    at TextEditor.transact (/usr/share/atom/resources/app/src/text-editor.js:2002:30)
    at HTMLElement.newCommandListeners.(anonymous function) (/usr/share/atom/resources/app/src/register-default-commands.js:704:28)
    at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app/src/window-event-handler.js:110:40)

Commands

     -0:23.1.0 command-palette:toggle (atom-pane.pane.active)
     -0:17.2.0 core:move-down (input.hidden-input)
     -0:17 core:confirm (input.hidden-input)
     -0:17 proto-repl:remote-nrepl-connection (atom-pane.pane.active)
     -0:16.5.0 proto-repl:remote-nrepl-focus-next (input.hidden-input)
     -0:14.4.0 core:confirm (input.hidden-input)
  2x -0:10.5.0 core:backspace (input.hidden-input)
     -0:04.5.0 editor:newline-above (input.hidden-input)

Non-Core Packages

atom-beautify 0.33.1 
atom-prettify 0.1.3 
atom-typescript 12.6.3 
auto-detect-indentation 1.3.0 
blame 1.0.1 
busy-signal 1.4.3 
change-case 0.6.5 
clojure-indent 0.4.0 
cursor-history 0.13.1 
custom-title 1.0.1 
elm-format 3.2.0 
expand-selection-to-quotes 0.11.0 
format-shell 2.0.0 
formatter 2.12.4 
formatter-tidy 1.0.1 
git-plus 8.1.0 
git-time-machine 2.1.0 
hard-wrap 1.7.1 
hclfmt 1.2.0 
intentions 1.1.5 
language-applescript 0.3.0 
language-docker 1.1.8 
language-elm 1.5.0 
language-gradle 0.0.5 
language-hcl 0.4.0 
language-jade 0.7.3 
language-javascript-jsx 0.3.7 
language-pgsql 0.2.3 
language-protobuf 0.7.1 
language-pug 0.0.22 
language-rust 0.4.12 
language-stylus 0.2.0 
language-terraform 0.8.1 
linter 2.2.0 
linter-eslint 8.4.1 
linter-js-yaml 1.3.0 
linter-jsonlint 1.3.0 
linter-markdown 5.2.2 
linter-rust 0.9.0 
linter-scss-lint 3.1.1 
linter-shellcheck 1.5.0 
linter-swagger 0.5.1 
linter-terraform-syntax 1.2.4 
linter-tslint 1.9.1 
linter-ui-default 1.7.1 
linter-xmllint 1.4.4 
mark 1.3.3 
markdown-fold 0.2.0 
markdown-folding 0.3.1 
pane-by-type 1.0.1 
pane-split-moves-tab 0.1.0 
pipe 0.4.0 
prettier-atom 0.55.2 
pretty-json 2.0.3 
proto-repl 1.4.24 
rustfmt 0.1.3 
rustsym 0.4.1 
sequential-command 0.3.0 
sort-lines 0.18.0 
terraform-fmt 0.3.0 
toggle-quotes 1.1.1 
tool-bar 1.1.10 
wordcount 3.0.0 
xml-formatter 0.11.0