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

Sniprun becomes quirky with snippets entailing a prompt for value from stdin #146

Open
kqvanity opened this issue Feb 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@kqvanity
Copy link

Describe the bug
A clear and concise description of what the bug is.

What do the bug concerns? Sniprun itself, a particular interpreter?
The bug seems to stem from sniprun

To Reproduce
Steps to reproduce the behavior:

  1. Open a source code file
  2. visually select a block of cpp/python code encompassing a line prompting the use for input via stdin
  3. open command mode and run Sniprun
  4. A varying quirky behavior arises .

Varying quirky behaviors

  • At terminal view with c++, it executes the whole code (prior to and after the use prompt line), but if i pressed a or i for input within the terminal , then the terminal essentially freezes .
  • At classic view, it just executes the whole code ignoring any lines of input functions .
  • Whether at terminal window or classic view with python, it just print RuntimeError: EOFError: EOF when reading a line

Expected behavior
Atleast the terminal window to be chosen, and i get the ability to input values normally .

Environment:

  • Neovim version [e.g. v0.6.0]
  • elementary os 6.1
  • Ubuntu GLIBC 2.31-Oubuntu9.2
@kqvanity kqvanity added the bug Something isn't working label Feb 11, 2022
@michaelb
Copy link
Owner

Long story short: i won't be able to make this work

Long story long:

Yup, taking stdin ('terminal' would be a display mode of choice) is a known limitation of sniprun (it's even in the readme). While technically not impossible, it's probably very tricky to make it work, because it involve passing the stdin handle to from neovim to the Rust part of the plugin to the actual code being executed.

Depending on what a c++/python/anything program does when stdin is closed, (returning EOF, waiting...) and on what interpeter and what features (REPL, live mode,..) are used, they might display quirkiness well beyond what you've described. I've had one that, once in a certain state, while using 100% of my CPU, displayed consistently the result of the previous snippet.

Essentially, I'm lacking the skill, will, and time to rework this.

Consolation prizes: i'ts certainly not impossible to do, at least for one (interpreted) language, see related projects. You should be able to close / hide the terminal view with :SnipClose

@kqvanity
Copy link
Author

taking stdin ('terminal' would be a display mode of choice) is a known limitation of sniprun (it's even in the readme).
Can you please reference this segment, because i'm sure it must have went on top of my head .

Thanks for considering that, and hopefully it will get resolved by time . For the mean time, i should be mindful of such a limitation .

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