Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running several cells prompts for a kernel on every cell #208

Open
serhez opened this issue Jun 11, 2024 · 2 comments
Open

Running several cells prompts for a kernel on every cell #208

serhez opened this issue Jun 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@serhez
Copy link

serhez commented Jun 11, 2024

  • OS: MacOS
  • NeoVim Version: 0.10
  • Python Version: 3.10
  • Python is installed with: mamba
  • Health checks
`:checkhealth molten`
molten: require("molten.health").check()

molten-nvim ~
- OK NeoVim >=0.9
- OK Python >=3.10
- OK Python module pynvim found
- OK Python module jupyter-client found
- OK Python module cairosvg found
- OK Python module pnglatex found
- OK Python module plotly found
- OK Python module kaleido found
- WARNING Optional python module pyperclip not found
  - ADVICE:
    - pip install pyperclip
- OK Python module nbformat found
- OK Python module pillow found
`:checkhealth provider` (the python parts)
provider.python: require("provider.python.health").check()

Python 3 provider (optional) ~
- Using: g:python3_host_prog = "~/envs/nvim/bin/python"
- Executable: /Users/ser/envs/nvim/bin/python
- Python version: 3.10.4
- pynvim version: 0.4.3
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

Description

When using molten and no kernel has been chosen yet, running the quarto-nvim functions run_below() and run_above() (and perhaps run_all(), as I haven't tested it) prompt the user for the desired kernel on every cell. Instead, running these functions should just prompt the user for choosing a kernel in the first cell being run. I opened an issue in quarto-nvim repo and the maintainers said this looked like a bug with molten.

Reproduction Steps

  1. Install molten and quarto-nvim.
  2. Open a multi-cell quarto file and use either of the commands run_below() or run_above().
  3. The user will be prompted with a kernel (via telescope, for example) and, after making a selection, the user will keep being prompted for kernel selections for as many times as cells it tried to run.

This does not look like a personal config-related issue, but I could provide my config for both plugins if needed.

Expected Behavior

Kernel selection should only happen once for a quarto (or any notebook type) buffer, whenever the first cell/range is run.

@serhez serhez added the bug Something isn't working label Jun 11, 2024
@benlubas
Copy link
Owner

I think the best way to fix this will be with some type of state check in here

def kernel_check(self, command: str, buffer: Buffer) -> None:
to see if we're waiting for a kernel to be ready, and if we are, just using that as the kernel. Might need a new variable to track that, not sure

@benlubas
Copy link
Owner

That actually should work right now, we start tracking the kernel immediately after :MoltenInit is called, and we do check for the kernel in the same way.

vim.schedule_wrap(function()

But this schedule wrap ruins things...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants