dccsillag / magma-nvim

Interact with Jupyter from NeoVim.
GNU General Public License v3.0
977 stars 49 forks source link

[Bug] Extremely slow after initializing kernel #100

Open Bigbadboybob opened 1 year ago

Bigbadboybob commented 1 year ago

Describe the bug Everything functionally works technically but when I run MagmaInit python3 vim becomes extremely slow, like there is a half second delay between any vim shortcut and the action. Additionally when I evaluate a line the out put just says Out[...]: * On Hold, even if it's just a print statement.

To Reproduce Steps to reproduce the behavior:

  1. Install plugin using lazy.nvim
  2. Go to any file (*.py or any other type of file) and run :MagmaInit python3

Expected behavior Vim should be reasonably responsive and magma outputs should show print statements.

Desktop (please complete the following information):

Bigbadboybob commented 1 year ago

I installed ipython and ipykernel and added another jupyter kernel to my conda environment but now the original kernel works fine. So I guess installing ipython and ipykernel fixed it.

dccsillag commented 1 year ago

Sounds like there is some bad busy loop (probably in the kernel status tracking code?), which should really be fixed.

dccsillag commented 1 year ago

This is probably at blame: https://github.com/dccsillag/magma-nvim/blob/ff3deba8a879806a51c005e50782130246143d06/rplugin/python3/magma/runtime.py#L218

Which is odd, since get_iopub_msg should be sleeping iirc. Unless it's consistently giving a "weird" reply, falling into the condition in https://github.com/dccsillag/magma-nvim/blob/ff3deba8a879806a51c005e50782130246143d06/rplugin/python3/magma/runtime.py#L222. So maybe we should add some logic before that continue to avoid a busy loop.