humio / atom-elm-format

Run elm-format in atom
https://atom.io/packages/elm-format
Apache License 2.0
10 stars 8 forks source link

Uncaught Error: This TextEditor has been destroyed #8

Closed a-l-f-r-e-d closed 7 years ago

a-l-f-r-e-d commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.8.0 System: Mac OS X 10.11.5 Thrown From: elm-format package, v1.2.1

Stack Trace

Uncaught Error: This TextEditor has been destroyed

At /Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:1002

Error: This TextEditor has been destroyed
    at DisplayBuffer.module.exports.DisplayBuffer.screenPositionForBufferPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:794:15)
    at TextEditorMarker.module.exports.TextEditorMarker.getHeadScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor-marker.js:179:33)
    at Cursor.module.exports.Cursor.getScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:73:26)
    at TextEditor.module.exports.TextEditor.getCursorScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1544:35)
    at Object.format (/Users/maneumann/.atom/packages/elm-format/lib/elm-format.js:99:33)
    at /Users/maneumann/.atom/packages/elm-format/lib/elm-format.js:49:25
    at Object.debounce (/Users/maneumann/.atom/packages/elm-format/lib/elm-format.js:57:7)
    at /Users/maneumann/.atom/packages/elm-format/lib/elm-format.js:48:16
    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 TextBuffer.module.exports.TextBuffer.saveAs (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1113:27)
    at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1083:19)
    at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:660:26)
    at Pane.module.exports.Pane.saveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:718:18)
    at Pane.module.exports.Pane.saveActiveItem (/Applications/Atom.app/Contents/Resources/app.asar/src/pane.js:701:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (/Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:684:35)
    at atom-workspace.commandRegistry.add.core:save (/Applications/Atom.app/Contents/Resources/app.asar/src/register-default-commands.js:214:32)
    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:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -1:43.8.0 editor:newline (atom-text-editor.editor.is-focused)
     -1:32.9.0 core:move-right (atom-text-editor.editor.is-focused)
  2x -1:32.4.0 editor:newline (atom-text-editor.editor.is-focused)
     -1:18 core:move-down (atom-text-editor.editor.is-focused.autocomplete-active)
     -1:17.6.0 autocomplete-plus:confirm (atom-text-editor.editor.is-focused.autocomplete-active)
  2x -0:58.8.0 editor:newline (atom-text-editor.editor.is-focused)
  2x -0:55.8.0 core:move-left (atom-text-editor.editor.is-focused)
     -0:40.5.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:40.2.0 snippets:next-tab-stop (atom-text-editor.editor.is-focused)
     -0:40.2.0 snippets:expand (atom-text-editor.editor.is-focused)
     -0:40.2.0 editor:indent (atom-text-editor.editor.is-focused)
  2x -0:39.6.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:34.2.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:30 core:save (atom-text-editor.editor.is-focused)
  2x -0:02.6.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:00.8.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "disabledPackages": [
      "asciidoc-preview"
    ],
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ]
  },
  "elm-format": {
    "binary": "/Users/maneumann/bin/elm-format",
    "formatOnSave": true
  }
}

Installed Packages

# User
atom-beautify, v0.29.7
autoclose-html, v0.23.0
autocomplete-html, v0.7.2
elm-format, v1.2.1
ide-haskell-cabal, v1.4.0
language-apache, v1.5.0
language-elm, v1.5.0
language-gradle, v0.0.3
language-groovy, v0.6.0
language-haskell, v1.7.16
language-kotlin, v0.4.0
language-scala, v1.1.6
linter, v1.11.4
linter-elm-make, v0.7.0

# Dev
No dev packages
benjick commented 8 years ago

Fixed in #11

OvermindDL1 commented 8 years ago

Had it happen just now, and Atom is showing no package updates for atom-elm-format. Either this issue is still occurring or the fix has not been pushed out yet?

benjick commented 8 years ago

What version are you running?

On Wed, Jul 20, 2016 at 11:24 PM, OvermindDL1 notifications@github.com wrote:

Had it happen just now, and Atom is showing no package updates for atom-elm-format. Either this issue is still occurring or the fix has not been pushed out yet?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/triforkse/atom-elm-format/issues/8#issuecomment-234087894, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaTGCYCHE16QumuCcBhghU0iac3U1fjks5qXpIOgaJpZM4Iv997 .

OvermindDL1 commented 8 years ago
$ cat ~/.atom/packages/elm-format/package.json
{
  "name": "elm-format",
  "main": "./lib/elm-format",
  "version": "2.0.1",
  "scripts": {
    "lint": "eslint .",
    "watch": "ucompiler watch",
    "compile": "ucompiler go"
  },
  "pre-commit": [
    "lint",
    "compile"
  ],
  "description": "Run elm-format in Atom",
  "keywords": [
    "elm",
    "format",
    "elm-format"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/triforkse/atom-elm-format.git"
  },
  "license": "MIT",
  "engines": {
    "atom": ">=1.0.0 <2.0.0"
  },
  "dependencies": {},
  "devDependencies": {
    "babel-eslint": "^6.0.2",
    "babel-preset-steelbrain": "^2.0.1",
    "eslint": "^3.0.0",
    "eslint-config-airbnb-base": "^3.0.1",
    "eslint-plugin-import": "^1.10.0",
    "pre-commit": "^1.1.2",
    "ucompiler": "^3.1.8",
    "ucompiler-plugin-babel": "^3.1.1"
  },
  "readme": "# elm-format\n\nRuns `elm-format` on save or manually\n\nGet `elm-format` at https://github.com/avh4/elm-format\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/triforkse/atom-elm-format/issues"
  },
  "homepage": "https://github.com/triforkse/atom-elm-format#readme",
  "_id": "elm-format@2.0.1",
  "_shasum": "3e7a4078bc92afe28e002ee6af512b34cf65fbf9",
  "_resolved": "file:..\\d-116614-15452-18lo3ni\\package.tgz",
  "_from": "..\\d-116614-15452-18lo3ni\\package.tgz",
  "_atomModuleCache": {
    "version": 1,
    "dependencies": [],
    "extensions": {
      ".js": [
        "lib\\elm-format.js",
        "lib\\settings.js",
        "src\\elm-format.js",
        "src\\settings.js"
      ],
      ".json": [
        "package.json"
      ]
    },
    "folders": []
  }
}
OvermindDL1 commented 8 years ago

And for note, it has happened a few more times as well.

OvermindDL1 commented 8 years ago

Still happening, found a few things about it to note.

  1. I save an elm file
  2. Elm-Format instead of popping up its one popup (over my tabs, which is annoying I do say since I cannot see or click through it, though I do like to know it happened as that means elm accepts the file) pops up endless popups, as I close them it keeps opening more.
  3. If I look in my process list I see that Atom is spawning hundreds upon hundreds of elm-format processes, keeps building and building and building until memory is gone if I let it.
  4. Closing the tab with the elm file stops the endless spawning (interestingly if that same file is opened in another tab in the same atom, say for dynamic views, that other one does not cause an issue).
  5. Waiting until all the processes close and the computer returns to normal speed
  6. Saving an elm file after this point causes the below:

Atom Version: 1.8.0 System: Microsoft Windows 10 Pro Thrown From: elm-format package, v2.0.1

Stack Trace

Uncaught Error: This TextEditor has been destroyed

At C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\pane.js:1002

Error: This TextEditor has been destroyed
    at DisplayBuffer.module.exports.DisplayBuffer.screenPositionForBufferPosition (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\display-buffer.js:794:15)
    at TextEditorMarker.module.exports.TextEditorMarker.getHeadScreenPosition (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\text-editor-marker.js:179:33)
    at Cursor.module.exports.Cursor.getScreenPosition (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\cursor.js:73:26)
    at TextEditor.module.exports.TextEditor.getCursorScreenPosition (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\text-editor.js:1544:35)
    at Object.format (C:\Users\<username>\.atom\packages\elm-format\lib\elm-format.js:99:33)
    at C:\Users\<username>\.atom\packages\elm-format\lib\elm-format.js:49:25
    at Object.debounce (C:\Users\<username>\.atom\packages\elm-format\lib\elm-format.js:57:7)
    at C:\Users\<username>\.atom\packages\elm-format\lib\elm-format.js:48:16
    at Function.module.exports.Emitter.simpleDispatch (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\event-kit\lib\emitter.js:125:28)
    at TextBuffer.module.exports.TextBuffer.saveAs (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1113:27)
    at TextBuffer.module.exports.TextBuffer.save (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1083:19)
    at TextEditor.module.exports.TextEditor.save (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\text-editor.js:660:26)
    at Pane.module.exports.Pane.saveItem (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\pane.js:718:18)
    at Pane.module.exports.Pane.saveActiveItem (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\pane.js:701:19)
    at Workspace.module.exports.Workspace.saveActivePaneItem (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\workspace.js:684:35)
    at atom-workspace.commandRegistry.add.core:save (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\register-default-commands.js:214:32)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:260:29)
    at C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (C:\Users\<username>\AppData\Local\atom\app-1.8.0\resources\app.asar\src\window-event-handler.js:3:61)

Commands

     -4:01.6.0 editor:move-to-beginning-of-word (atom-text-editor.editor.is-focused)
  3x -4:01.1.0 core:move-left (atom-text-editor.editor.is-focused)
     -4:00.4.0 core:move-right (atom-text-editor.editor.is-focused)
     -4:00.1.0 editor:select-to-beginning-of-word (atom-text-editor.editor.is-focused)
  6x -3:01.4.0 blur (atom-text-editor.editor.is-focused)
  2x -1:24.9.0 linter:lint (atom-text-editor.editor)
  2x -1:24.9.0 blur (atom-text-editor.editor)
     -1:23.8.0 editor:newline (atom-text-editor.editor.is-focused)
     -1:14.5.0 editor:delete-to-beginning-of-word (atom-text-editor.editor.is-focused)
     -1:10.9.0 core:save (atom-text-editor.editor.is-focused.autocomplete-active)
 19x -1:09.0 blur (atom-text-editor.editor.is-focused)
     -0:43.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
  6x -0:35.6.0 blur (atom-text-editor.editor.mini.is-focused)
  2x -0:03.7.0 linter:lint (atom-text-editor.editor)
  3x -0:03.6.0 blur (atom-text-editor.editor)
     -0:03.2.0 core:save (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "autoHideMenuBar": true,
    "disabledPackages": [
      "autocomplete-go",
      "atom-powersnap",
      "activate-power-mode-delete",
      "autocomplete-dcd",
      "elm",
      "autocomplete-en-en",
      "spell-check",
      "latex-completions",
      "erlang-build"
    ],
    "projectHome": "C:\\Users\\<username>\\Projects",
    "themes": [
      "atom-dark-ui",
      "solarized-dark-syntax"
    ]
  },
  "elm-format": {
    "binary": "C:\\Program Files (x86)\\Elm Platform\\elm-format-0.17-0.4.0-alpha-win-x64\\elm-format.exe",
    "showNotifications": true
  }
}

Installed Packages

# User
activate-power-mode, v0.7.0
ascii-codes, v0.3.3
ascii-hex, v0.2.0
atom-autocomplete-erlang, v0.6.19
atom-beautify, v0.29.10
atom-elixir, v0.2.1
atom-formatter-jsbeautify, v1.1.2
atom-svg-icon-snippets, v0.3.3
atomic-chrome, v0.3.0
autocomplete-asciidoc, v0.1.1
autocomplete-awk, v0.1.2
autocomplete-cmake, v0.3.1
autocomplete-elixir, v1.5.14
autocomplete-emojis, v2.5.0
autocomplete-erlang, v1.1.2
autocomplete-fortran, v0.9.1
autocomplete-gdscript, v0.4.0
autocomplete-glsl, v0.2.3
autocomplete-html-entities, v0.1.0
autocomplete-js-import, v1.0.1
autocomplete-json, v5.1.0
autocomplete-mathjax, v0.1.1
autocomplete-modules, v1.5.2
autocomplete-oracle, v0.4.0
autocomplete-php, v0.3.7
autocomplete-python, v1.8.2
autocomplete-xml, v0.8.3
build-elixir, v0.6.0
build-powershell, v0.3.4
character-table, v0.4.3
clipboard-plus, v0.5.1
data-atom, v0.21.0
elixir-cmd, v0.2.9
elm-format, v2.0.1
elm-snippets, v0.1.0
emmet, v2.4.3
emoji-code, v0.3.1
erlang-autocompile, v0.1.1
es-identifier-highlight, v0.2.11
filesize, v0.4.2
fill-line, v1.0.0
fold-functions, v0.4.3
font-awesome-snippetset, v0.0.6
fonts, v1.6.0
git-checkout, v0.3.2
git-commit, v1.5.2
git-diff-details, v1.3.0
git-log, v0.4.1
go-config, v1.2.1
go-get, v1.0.3
hex, v0.6.2
highlight-bad-chars, v1.0.5
html-entitize, v1.1.0
language-asn1, v0.3.0
language-batchfile, v0.4.0
language-csv, v1.1.2
language-elixir, v0.14.0
language-elm, v1.5.0
language-elmx, v1.2.6
language-erlang, v3.0.0
language-javascript-jsx, v0.3.7
language-oracle, v1.4.1
language-pgsql, v0.2.3
language-powershell, v2.1.1
language-story, v1.2.0
language-svg, v0.9.0
linter, v1.11.14
linter-checkbashisms, v0.1.5
linter-elixir-credo, v1.1.0
linter-elm-make, v0.12.2
linter-erlang, v0.3.1
linter-erlang-dialyzer, v0.0.1
minimap, v4.24.7
minimap-bookmarks, v0.3.1
minimap-codeglance, v0.4.5
minimap-cursorline, v0.2.0
minimap-git-diff, v4.3.1
minimap-highlight-selected, v4.4.0
minimap-linter, v1.1.1
minimap-pigments, v0.2.1
minimap-selection, v4.4.0
open-no-binaries, v0.1.1
phoenix-elixir-snippets, v0.4.0
pigments, v0.31.2
project-colorize, v0.2.0
qolor, v0.2.2
react, v0.15.0
resize-indent, v0.3.0
svg-preview, v0.7.4
tabular, v0.1.0
text-manipulation, v0.6.0
tree-view-git-branch, v0.1.2
tree-view-git-status, v1.0.2

# Dev
No dev packages
OvermindDL1 commented 8 years ago

Yeah I have gotten to the point that when I see a ton of "Linting..." messages at the bottom (such as at http://i.imgur.com/OoooBP8.png for example) and the interface start slowing down then I know that there are already a hundred+ of those formatting processes so I alt-tab to the task manager and kill atom process tree (thus killing the formats) because for some reason at those times not even Ctrl+Alt+r works (it seems to half-kill atom, like it is waiting on something)... If I close the file it will also stop it, but it also causes the format to start popping up the above stacktrace/error every time I save. Is this still closed for a reason?

benjick commented 8 years ago

Thanks @OvermindDL1. I'm on vacation now, I will try it when I get back!

benjick commented 8 years ago

Do you also have Elm format enabled via atom-beautify? Because this plugin has no popup

OvermindDL1 commented 8 years ago

Ah indeed I do, I will disable that for a while and give it a try again. I did not even know about atom-beautify, did it come with atom or did I install it somehow? >.>

OvermindDL1 commented 8 years ago

For note, it was set to never auto-beautify, even on save, but I completely disabled it anyway.

OvermindDL1 commented 8 years ago

Ran atom for a little bit after disabling atom-beautify, the issue happened again with infinite elm-format's spawning. I tried to enable atom-beautify and disable atom-elm-format, but atom-beauty errored about not finding elm-format (it does not even have a place to put its path), so it was not doing anything anyway, disabled again though and re-enable atom-elm-format

benjick commented 8 years ago

Is this resolved?

OvermindDL1 commented 8 years ago

I'll try tomorrow, message me here then? I usually keep the auto-format-on-save disabled because of the locking-up and I just realized that I've not run elm-format in atom in probably a week now... Poor code formatting... >.>

anagrius commented 8 years ago

Can't reproduce, close?

benjick commented 7 years ago

Closing due to inactivity