sniprun
sniprun copied to clipboard
Sniprun becomes quirky with snippets entailing a prompt for value from stdin
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:
- Open a source code file
- visually select a block of cpp/python code encompassing a line prompting the use for input via stdin
- open command mode and run
Sniprun - 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
aorifor 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
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
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 .