dccsillag / magma-nvim

Interact with Jupyter from NeoVim.
GNU General Public License v3.0
1.02k stars 53 forks source link

[Bug] Error when invoking MagmaDelete #52

Closed matthewsia98 closed 2 years ago

matthewsia98 commented 2 years ago

Describe the bug Error when invoking MagmaDelete

Error detected while processing function remote#define#CommandBootstrap[5]..remote#define#request:              
line    2:                                                                                                      
Error invoking '/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma:command:MagmaDelete' on chann
el 3 (python3-rplugin-host):                                                                                    
error caught in request handler '/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma:command:Magm
aDelete []':                                                                                                    
Traceback (most recent call last):                                                                              
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/utils.py", line 14, in inner         
    func(self, *args, **kwargs)                                                                                 
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/__init__.py", line 265, in command_de
lete                                                                                                            
    magma.delete_cell()                                                                                         
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 171, in delete_
cell                                                                                                            
    self.update_interface()                                                                                     
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 179, in update_
interface                                                                                                       
    self.clear_interface()                                                                                      
  File "/home/siam/.dotfiles/nvim/plugged/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 151, in clear_i
nterface                                                                                                        
    self.outputs[self.selected_cell].clear_interface()                                                          
KeyError: <magma.utils.Span object at 0x7ff90094fa30> 

To Reproduce Steps to reproduce the behavior:

  1. Select range and invoke MagmaEvaluateVisual OR invoke MagmaEvaluateLine
  2. Invoke MagmaDelete while cell is selected
  3. See error

Expected behavior Delete the cell

Screenshots

image image image

Desktop NVIM v0.8.0-dev-888-g7ff283b1b Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

fe-lipe-c commented 2 years ago

Having the same issue since yesterday, when I updated the plugin. After the error message appears, when invoking MagmaDelete, the same message keeps popping up, forcing me to restart nvim.

MrBober commented 2 years ago

I have the same issue You can go back to commits before edfd16e (which is the commit that broke it) The newest commit before that one was: edf60f0 so you can just go to autoload/plugged/magma-nvim and run git checkout edf60f0b809c88dab3a4ea492e0dcf80fc00af5b

MrBober commented 2 years ago

So... I found a problem, basically sometimes it was trying access a key in self.outputs while it was empty, so I just made it check if key is in the dictionary before trying to access it and that fixed the issue

dccsillag commented 2 years ago

Solved in 395b48e2e202d82fca76c15d2dcd8785c125d686 (via #58). Thanks, @MrBober!