atom-minimap / minimap

A preview of the full source code.
https://atom.io/packages/minimap
MIT License
643 stars 129 forks source link

Uncaught TypeError: Cannot read property 'getTextEditorElement' of null #763

Closed the-woocash closed 3 years ago

the-woocash commented 3 years ago

[Enter steps to reproduce:]

  1. Right click minimap, select Toggle Minimap
  2. Observe that the content of the minimap pane disappears, but the space taken by the minimap pane is still taken by now empty pane
  3. Switch to a different tab to check whether the problem persists
  4. Get red error popup

Atom: 1.54.0 x64 Electron: 6.1.12 OS: Microsoft Windows 10 Pro Thrown From: minimap package 4.39.0

Stack Trace

Uncaught TypeError: Cannot read property 'getTextEditorElement' of null

At C:\Users\username\.atom\packages\minimap\dist\main-0471cbc5.js:1

TypeError: Cannot read property 'getTextEditorElement' of null
    at HTMLElement.attachedCallback (/packages/minimap/dist/main-0471cbc5.js:1:68921)
    at /packages/minimap/dist/main-0471cbc5.js:1:24333)
    at HTMLElement.activeItemChanged (/app.asar/src/pane-element.js:152:22)
    at Function.simpleDispatch (~/AppData/Local/atom/app-1.54.0/resources/app/static/<embedded>:11:1190181)
    at Emitter.emit (~/AppData/Local/atom/app-1.54.0/resources/app/static/<embedded>:11:1191622)
    at Pane.setActiveItem (~/AppData/Local/atom/app-1.54.0/resources/app/static/<embedded>:11:456849)
    at Pane.activateItem (~/AppData/Local/atom/app-1.54.0/resources/app/static/<embedded>:11:459097)
    at TabBarView.onClick (~/AppData/Local/atom/app-1.54.0/resources/app/static/<embedded>:11:1141102)

Commands

     -0:12.4.0 minimap:toggle (canvas.)

Non-Core Packages

file-type-icons 1.3.4 
minimap 4.39.0 
remote-ftp 2.2.4 
aminya commented 3 years ago

[Enter steps to reproduce:]

  1. Right click minimap, select Toggle Minimap
  2. Observe that the content of the minimap pane disappears, but the space taken by the minimap pane is still taken by now empty pane
  3. Switch to a different tab to check whether the problem persists
  4. Get red error popup

The error does not show for me. When you disable Minimap, you should resize the editor a bit so the scroller goes to the right. There is no API to make this automatic.

aminya commented 3 years ago

@the-woocash I found the issue. It is fixed now.

the-woocash commented 3 years ago

@the-woocash I found the issue. It is fixed now.

Thanks a lot! Will Your solution by any chance also solve issue #764?

aminya commented 3 years ago

@the-woocash I can look into that. There is a PR to investigate this issue.

765

meetaig commented 3 years ago

I am still facing this issue with the newest version of Minimap (4.39.5). The issue is the same as above, but I can reliably reproduce it on Windows 7 when moving a pane from one side of the editor to the other. I do this by pressing Alt+Ctrl+Shift+Arrow using the Move Panes package (version 0.2.0). This could still be an issue on the side of Move Panes, but this issue is linked in the popup window, so I thought to report it here.

Uncaught TypeError: Cannot read property 'getTextEditorElement' of null

TypeError: Cannot read property 'getTextEditorElement' of null at HTMLElement.attachedCallback (C:\Users\User\.atom\packages\minimap\dist\main-91f6e642.js:1:69413) at HTMLElement.value [as attachedCallback] (C:\Users\User\.atom\packages\minimap\dist\main-91f6e642.js:1:24833) at HTMLElement.activeItemChanged (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app.asar\src\pane-element.js:152:22) at Function.simpleDispatch (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:1190181) at Emitter.emit (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:1191622) at Pane.setActiveItem (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:456849) at Pane.activateItem (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:459097) at Object.swapEditor (file:///C:/Users/User/.atom/packages/move-panes/lib/move-panes.coffee:41:12) at Object.move (file:///C:/Users/User/.atom/packages/move-panes/lib/move-panes.coffee:35:8) at Object.moveRight (file:///C:/Users/User/.atom/packages/move-panes/lib/move-panes.coffee:11:18) at HTMLElement.atom.commands.add.move-panes:move-right (file:///C:/Users/User/.atom/packages/move-panes/lib/move-panes.coffee:4:70) at CommandRegistry.handleCommandEvent (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:350382) at KeymapManager.dispatchCommandEvent (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:1230982) at KeymapManager.handleKeyboardEvent (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:1227116) at WindowEventHandler.handleDocumentKeyEvent (C:\Users\User\AppData\Local\atom\app-1.54.0\resources\app\static\<embedded>:11:284879)

aminya commented 3 years ago

@meetaig thanks for the reproduction. I will try to look into this.

aminya commented 3 years ago

Which move-panes package are you using?

Trying a simple command with move-panes triggers an error that is not related to Minimap.

image

meetaig commented 3 years ago

yes, that's the package. Seems like its the culprit. I didn't look into this too deep, but I see that this package has issues open from 2015, so I will just try to find a different package. I can reproduce your error as well. Thanks for looking into it so quickly!

UziTech commented 3 years ago

It looks like moving items between panes is built into atom now. You can just add keymaps to window:move-active-item-to-pane-on-right and other directions.

aminya commented 3 years ago

Closing this because it seems it is fixed.